Welcome and have a nice stay !       login   register   need help?  

 Page Info

Page Title: CSS Page Layouts
Description: Basic Introduction to create a complete CSS Page Layout
Author: ELTS
Submission Date: 18-12-2005 18:25

 Rating & Comments

View or add comments: (1)
Average members rating: 9.00



Welcome! Here is a quick, basic, easy tutorial I wrote on CSS layout and it's advantages. I hope it helps someone. (I aim this at new commers that want to learn to make sick layouts like my own ;-) I expect that you know basic HTML and how to create a .css file.

Cascading Style Sheets control everything from font style, color and size to text positioning, background color and much more. The power behind CSS is that you can have "blocks" of text, for example, that all have a "style." Instead of using the now outdated
Code :
// hide source code
// hide line numbers

1  <font style="color: red">

tag you would create a CSS style named: .red and simply call that style in a paragraph tag:

i.e.:
Code :
// hide source code
// hide line numbers

1  <p style="red">CONTENT</p>

-> CONTENT

With ONE site wide CSS document you can edit ANY aspect on the fly, one time and have site wide affect. CSS can also change the effect of entire tags like the tag for example. The tag controls many aspects of the HTML page. Not only background color but also page font options (and more). Instead of placing the SAME tag over and over in several pages you can simply set the style for the body element within the CSS document and save yourself the risk of making a mistake with many edits.

For Example, If you place:

Code :
// hide source code
// hide line numbers

 1  body {
 2  background-color: #FFFFFF;
 3  margin: 0px;
 4  font-family: Geneva, Arial, Helvetica, sans-serif;
 5  font-size: 11px;
 6  color: #696969;
 7  background-image:url(style/bars.jpg);
 8  background-position:center;
 9  background-repeat: repeat-y;
10  vertical-align: top; 
11  



... within your CSS file, every page created with that CSS file will have a white background, font-family Geneva, Arial, Helvetica, sans-serif; and 11px font size-- et cetera, et cetera-- Pretty much all tags can be edited like this. You can also create your own tags ...


The div tags control position and layout for the site.

When I put a div tag like: (in my HTML document)

Code :
// hide source code
// hide line numbers

1  <div id="content">



I am calling this code from the CSS document:

Code :
// hide source code
// hide line numbers

1  #content {
2  margin-left:180px;
3  padding-left:15px;
4  border-left:1px solid #cccccc;
5  }


With margin attributes I can set any element (images, text, anything) at any position on the page. The above example puts the content, within the div tag, 180px from the left side of the window. There are many different margin/positioning options available to CSS. (Dreamweaver has an easy to use interface for editing such div tags [in the edit style window])

Page layout example controlled by CSS:

I know that a lot of beginning web designers want to know how to get their content to be in a sleek layout like the site your looking at (;-P) Atleast I did. Here is the basics... Read it a few times and screw around.

A page normally consists of several distinct body parts:

#A page holder. This may be a CSS border or a background image that gives the page a feeling of containment.
#Header containing title and any graphics
#Menu Options
#Main Content
#Footer containing copyright information, etc.


Like the name implies, Cascading Style Sheets do cascade down the page and have a downhill affect on other styles and what ones get priority. To get the layout we want, we are going to use div tags. For div tags, it's pretty straight forward. Here's an example of a few div tags that might be used to position and organize the above body parts.

Code :
// hide source code
// hide line numbers

 1  <div id="container"> <!-- this tag stays open till the very end of the page - it could create the background or side bars, set page width and center the page content-->
 2  
 3  
 4  <div id="header"> Insert top graphics/whatever header info </div>
 5  
 6  
 7  <div id="menu"> list of menu options </div>
 8  
 9  
10  <div id="content"> This will be the most frequently used and edited region and contains all the center content for the page</div>
11  
12  
13  <div id="footer">Footer content</div>
14  
15  
16  </div> <!-- this is not an extra closing div tag but the closing tag for the container. Page ends at this point -->



Obviously the above would go into the actual HTML page and not the CSS document. (Since we are calling those styles from the CSS document.)
I could go in-depth into setting the different attributes of each div style in the actual CSS document but that's half the fun. Just so you know, a div ID tag is defined by the hash (#) symbol. So an ID style IN CSS looks like:

Code :
// hide source code
// hide line numbers

1  #banner {
2  margin:0 auto 0 auto;
3  text-align:center;
4  margin-bottom:25px;
5  height: 240px;
6  background-image: url(style/banner.jpg);
7  background-position: top;
8  background-repeat: no-repeat;
9  



You could then call that with:

Code :
// hide source code
// hide line numbers

1  <div id="banner"> </div> 



So on and so forth...There are a lot of sites that explain all the different attributes and options available. (Dreamweaver also has tag info in the app)

Anyway, I hope that helps a little. Once you have an idea down of what you want the container to look like and where the main content where go, the site will go quickly. (As far as content deployment ;-P)

Have fun.

Donation:

If you like our free quality work, make a donation by using Paypal and tell us what you would like to see improved on our site for the next few months.

Comments


Dumb Genius  Comment #2191 posted on 03-11-2006 20:53

Nice tut.


 Site Activity
Currently online: 0 member(s), 39 guest(s) : All members offline.


 Quick Menu
sitemap
search
galleries
main
forums


 Our Services

Main Projects
Designers For Hire
Unique LDU Skins
LDU Skins For Sale
Seditio Skins For Sale
Templates For Sale


 Statistics
18582 registered members,
1870 topics in forums,
21584 posts in forums,
13589673 pages served since 2004-05-09.
more


 7th Version Design

+++
top