Jump to content
aniketpunk

Header problems :(

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!!!!!!

Share this post


Link to post
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;}

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...