14 - Container div Tutorial ~

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Learn These Tools & Concepts:

checkContainers are like big boxes that hold everything.

check Every web page needs some sort of container.

 

  •   The purpose of container divs is so the content of the browser flexes to fit the size of the screen the page is being viewed upon.

 

  •   If you've been following this series of tutorials, you should now have created a CSS document with body and html tags.


  This tutorial is third in a series:

1 - Body    2 - HTML    3 - Containter  4 - Header    5 - Nav     6 - Content   7 - Footer  

Other People's Work:

Here are examples of work inspired by this tutorial.

Example 1

Example 2

Example 3

Step #1: Make a New CSS Rule ~

x Hopefully you've done this tutorial first …

x Add a new CSS rule by clicking on the plus sign.

new css rule

x This time, add an ID to styles.css

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Step #2: Call the Rule container ~

x Type container as the name of the id rule …

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

x Press OK when you are done.


Step #3: Define container Rules ~

x Select Box

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

x Set width to 80% - for now …

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

x Remember, you don't have to get married to any of this! You can change the settings later.


Step #4: Center the container ~

x Set margin to auto

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

xauto centers the div by giving it equal space on each side. Don't ask why, it just does …


Step #5: Auto Height on the container ~

x Set height to auto …

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Step #6: Position the container ~

x Click on Positioning and set Type = Relative

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

x relative is important because all the other rules depend on it for their instructions …


Step #7: Add a New Property ~

x Stretch the CSS panel so you can see the properties menu …

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

x Click Add Property to the container

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Step #8: min-height ~

x Click the arrow and select min-height

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

x Make the min-height 100 %

min-height


Step #7: container Color ~

x Choose another color from your Kuler Color selection by copying the HEX number from your Swatches.

swatches

x (You may need to go to: kuler.adobe.com and find your color scheme)

x Add it to the background of the #container

pound sign


Step #8: Insert the container Div in the Page ~

x Now, click inside the page somewhere in the Design area …

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

x Go to: Edit > Select All … and select all the content of your page …

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Step #9: Insert a Div on your Page ~

x Then go to: Insert > Layout Objects > Div tag

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Step #10: Attach the #container Div ~

x Then attach the container rule you just made to the div.

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player


Step #11: Now You See This ~

x The background color of your div should be different than the background of your page.

content for class

check mark Hit F12 or select small to view your work.

preview


Last Step: Save and Attach ~

x Save your styles.css file, attach it and continue working …


Other Resources: http://codecamel.com/fullheight