Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Designing with CSS<br />
Assignment Three – Floats for 2 Columns<br />
Advanced Web Design – Assignment #3 September 8, 2010<br />
Floats for Columns – Sports Theme<br />
Class Assignment:<br />
1. Today’s <strong>assignment</strong> must be called Floatlayout_lastname<br />
2. Using any sports theme you would like, create a webpage with a<br />
container div, header div, sidebar div, maincontent div, and<br />
footer div.<br />
3. The sidebar must be floated left.<br />
4. The mainContent must have a large left margin to leave space<br />
next to the floated sidebar<br />
5. Must have a footer that has the .clearfloat class applied to it<br />
6. Two divs must have background images in them.<br />
7. Use line spacing to get a nice flow to your text.<br />
8. Remember to use padding and margins to position items.<br />
9. Make the page have pleasing color combinations<br />
CSS Cheat Sheet<br />
Typical Page Layout using divs in the xhtml are :<br />
Insert a div called header<br />
Insert a div called sidebar<br />
Insert a div called main content<br />
Insert a div called footer<br />
And then put a div all around the above divs. Call it container. Be<br />
sure all the divs are inside <strong>of</strong> it.<br />
After you have entered content onto your page and you have<br />
wrapped them in divs, you are ready to change the “look” <strong>of</strong> the page<br />
with CSS. Here are some tips that you will use over and over:<br />
Body tag = specify the font, font size, font color, background page<br />
color, and<br />
• set your margin and padding to 0 (this is good practice to zero
out the default settings <strong>of</strong> different browsers built in style sheets<br />
that add spacing)<br />
• and set the text-align to center (this is a workaround to center<br />
the container in Internet Explorer – be sure to set the text align<br />
back to left in the rule below for the container)<br />
CSS Rule for the container div = set the width <strong>of</strong> the container –<br />
maybe<br />
780 - 900, background color, and to center this div set your margins<br />
to auto auto on the right and left to center this div and text-align to<br />
left to get your text back to the left after setting it to text-align center<br />
on the body tag.<br />
CSS Rule for the header div = set the background color and any<br />
padding so that your text or image lines up where you want it.<br />
CSS Rule the header h1 tag= set your margins to 0. This helps to set<br />
the element to the specs to will add. Add padding as needed. Set your<br />
color <strong>of</strong> the heading and size and font to what you would like<br />
CSS Rule the sidebar div = If you are using “floats” to give a 2 column<br />
layout, then you might float this sidebar div but BE SURE to give it a<br />
width.<br />
All floated elements should have a width specified. We might choose<br />
around 200px depending on the size <strong>of</strong> your container. If you give it a<br />
background color, it will only have this color as long as there is<br />
content.<br />
CSS Rule the main content div = If you are using “floats” to give a 2<br />
column layout, YOU MIGHT set a very large LEFT or RIGHT margin<br />
on one side <strong>of</strong> this div. Ex. margins 0 0 0 250px. It will keep all <strong>of</strong> the<br />
content over to one side. If you do not do this, then the content will<br />
flow next to the sidebar and all around it.<br />
CSS Rule for the footer div = You can put a background color or<br />
image behind the div and remember to use padding to control the text<br />
inside <strong>of</strong> this div. If you are using “floats” to give a column layout,<br />
then you must CLEAR<br />
THE FLOAT on the footer div. (See following tip)
Classes for floating = Often rules are set up for floating elements<br />
right, left and also to clear the float. Remember classes are generally<br />
created and then you must apply them in the drop down in the<br />
Property Inspector. Typical classes for floats are called .fltlft, .fltrt,<br />
and .clearfloat<br />
Other css rules you might create would be rules for paragraphs – p<br />
tag and<br />
more complex rules such as #footer p = paragraphs that are in the<br />
footer only. Etc.