Jump to content

3 sections?


eduard

Recommended Posts

I want 3 sections in my web page! Can I write <div1> <div2> <div3> or how does the browser read my html file? (What first, second, third, etc.?

Link to comment
Share on other sites

You can have classes on the divs, but not change the tag name itself.The browser reads everything in the order you write it.Class or ID names should describe the kind of section you have, and in fact, they must not start with a digit. You can have for example:

<div class="section1"></div><div class="section2"></div><div class="section3"></div>

but it's even better if you have for example:

<div id="header"></div><div class="main"></div><div class="footer"></div>

Link to comment
Share on other sites

You can have classes on the divs, but not change the tag name itself.The browser reads everything in the order you write it.Class or ID names should describe the kind of section you have, and in fact, they must not start with a digit. You can have for example:
<div class="section1"></div><div class="section2"></div><div class="section3"></div>

but it's even better if you have for example:

<div id="header"></div><div class="main"></div><div class="footer"></div>

Thank you very much!
Link to comment
Share on other sites

You can have classes on the divs, but not change the tag name itself.The browser reads everything in the order you write it.Class or ID names should describe the kind of section you have, and in fact, they must not start with a digit. You can have for example:
<div class="section1"></div><div class="section2"></div><div class="section3"></div>

but it's even better if you have for example:

<div id="header"></div><div class="main"></div><div class="footer"></div>

Thanks! But what should I write in the stylesheet?
Link to comment
Share on other sites

depends on what you you want it to look like. The code provided will create three "boxes" stacked on top of the other, because that's how block level elements behave, by starting on a new line. It's up to you to decide what their styles look like, which you could apply as such:

#header{  background-color: red;  height: 100px;}#main{  background-color: blue;  height: 300px;}#footer{  background-color: green;  height: 100px;}

the height is needed because since their is no content in the div, they will essentially "collapse" and you won't see the background colors.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...