Question:
Can CSS do this?
clumsyraine
2008-03-31 15:50:22 UTC
I'm about to start teaching myself CSS but I want to make sure it can do what I need it to do first -

I have a website now with 25 pages and still expanding. Header at the top, menu at the left. At the very least I want to use a separate style sheet for the menu (so I only have to edit it once and each page calls up that file), and I'd like to make the header, footer and menu stationary instead of scrolling with the page.

A) is it possible with just html and css?
B) is it complicated? (easy, medium, difficult?)

(If you happen to want to throw in a good tutorial site, I wouldn't complain either!)

Thanks!
Eight answers:
Imma M
2008-03-31 16:16:34 UTC
If you are talking about editing the style of the page then it's possible, and in fact that is basically what css was designed for.

There's three things you will need to do.

1) Apply some form of grouping to each section, you can do this a few ways, The most popular is enclosing the sections in a div tag and assigning it a specific class ID.

2)Create the CSS File, and upload it.

3)include the css file into each page needing it.

Look here for positioning in CSS (as well as other great info)

http://www.w3schools.com/css/pr_class_position.asp



That will certainly take care of your header and footer issues.



The menu issue is a bit different. If you want to edit actual content in one file that will affect all pages, then you will need to use a server side include. Fortunately this is fairly easy if a host allows a server side scripting language such as PHP.

It's fairly simple and would involve you creating a file that held our menu code, and using an include line on the page.

It is described here:

http://www.stevedawson.com/article0012.php



If you have access to PHP and can create a simple database for your site then you can take it one step further and define the path to your menu include as a record in a basic table, and use that to call up the file. The benefit of this is that if you choose to change the path to your menu (ie move the file you are using to another folder or rename it), you only have to change the path in one place instead of changing code on every page. It will also allow you to easily have a test site where you can work on things using identical code, but when you upload the final files the paths stored in the respective databases correct the structures for each without having to recode paths.





And to offer a bit of advice, only use tables to present data that is separated into columns and rows such as orders, stats, and database results. Formating should be done in HTML/CSS. It is far more flexible
pryce
2016-10-16 09:40:02 UTC
in comparison to HTML, CSS would not "create" something. incredibly, it decorates, aligns, and positions (etc) aspects in HTML. In a nutshell, CSS takes the traditional HTML output and provides some policies to how that is surely displayed. CSS can edit issues which includes ingredient width and top, history color, border, alignment, and surely visibility, for starters. HTML is able to doing slightly of those issues, yet as pronounced until now, the strategies are frequently deprecated, or are quickly to be deprecated. CSS is integrated right into an internet site using inner markup (in the pinnacle; in type tags) or exterior markup (From a ".css" document).
rsraszka
2008-03-31 16:04:22 UTC
A) Yes, If you have plain HTML currently you do this right now! All you will need to do is take the HTML code out of one page and then redesign the page to include the HTML "snippets" in each page. This is known as SSI (Server Side Includes) and is support by most Web Servers. All you need to do is place a line of the form:



and this will be inserted at the location specified.



B) Easy to do but may take sometime to redesign your pages.



CSS will not necessarily allow to do this, what it provides is the ability to change the way you web site looks and feels quickly and layouts. To get the best of a web site it is good to use both techniques to be able to make it look fresh and renewed for all those people on the net.
anonymous
2008-03-31 16:07:16 UTC
Create one style sheet, then using
to break up the page and the overflow auto for the part you want to scroll you can set one or more sections to scroll independently. If you use php to dynamically build pages you can have one page containing all the headings etc that are used on different pages and then use include to add the central sections individually. This also makes possible identifying a browser and selecting different css section labels to allow for the differences in browsers.
2Hawks
2008-04-01 07:37:02 UTC
Absolutely, yes, it can. There are a few tricks, of course, that you'll have to figure out, but here are two sites that I found most helpful:



First, Stu Nichols' site CSSPlay. This man seems to enjoy tinkering with CSS just to make it do things we're told it can't do. Like swap image files. Go here first.

http://www.cssplay.co.uk/index



Second, this location answers your question directly.

http://www.askdavetaylor.com/how_do_i_have_a_shared_css_menu_system.html



As with all things code, the browser quirks are the most challenging. Stu Nichols deals with this well.



Good luck,

Ed
anonymous
2008-03-31 16:30:03 UTC
If you give your header, menu and footer separate id names you can write separate styles for each of them. For instance, you could do something like:











Then in your css could look like:



#menu{ ...menu style here... }

#header{...header style here...}

#footer{...footer style here...}



Web design with css is much easier than without, and it can save you time from replicating the same code over and over. Here's a good tutorial site for you that has css and loads of other helpful tutorials:



http://www.w3schools.com/default.asp



I particularly found the javascript tutorial a helpful start.
petsnakes
2008-03-31 15:56:21 UTC
For someone who knows that they're doing it would probably be pretty easy. For someone like me it is medium to hard



http://www.w3schools.com/css/default.asp
Ethan
2008-03-31 16:05:57 UTC
Yes its possible. Frames or IFrames might also be what you are looking for


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...