Jump to content

Header problems :(


aniketpunk

Recommended Posts

Hey Guys... I really dont undertand th use of <div> tag in and meaning of "container" in:-

<div id="container" style="width:500px"><div id="header" style="background-color:#FFA500;">

 

 

If there is a link to w3schools then plz post..Please HELP!!!!!!

Link to comment
Share on other sites

Divs require some kind of identification so you can tell what each one does. In your case, id="container" is commonly used as a way to set the overall width of the site's design. So anything within that 'container' div will be contained to whatever width you set it for. Some people would use id="wrapper" instead but you can call it whatever you like but it's ideal to call it something that is easily identifiable.

 

id="header" is another example. This is commonly used for logos, top navigation, etc. Again, you don't have to use that identifier...you could call it 'masthead' or 'pageheader'.

 

id's names should only be used once. Classes can be used more than once.

 

Again, it's not really important what you call it so long as you understand what it means to you but it would be a good practice to keep them consistence.

 

<div id="container">

<div id="header">logo, background header image, etc </div>

<div id="leftcol">left column for left navigation</div>

<div id="content">page content</div>

<div id="footer">bottom footer for links, copyright info, etc.</div>

</div><!-- end 'container' div-->

 

The above is just a small example and can be defined any way you like. The idea to use id's (and classes) is so that you can use CSS to style them. More importantly you can define them using a css stylesheet file linked to your page file.

 

Here's what you have:

<div id="container" style="width: 500px;">

 

Using a css file linked via within your page's <head></head> section you will have something like this:

 

<div id="container">

 

...and your css file will look like this:

#container {width: 500px;}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...