Solved

CSS: why do these <div> show inside <body>? pls take a look

Posted on 2011-02-17
4
178 Views
Last Modified: 2012-05-11
Hello Experts,

Please look at the code below, why do these <div> show inside <body> when looking at the source code?

thanks experts,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<title> test </title>

<!--[if lt IE 9]>
	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

<!-- CSS -->
<style>
#bg {background: #9E1110; height:4px; margin: 0px 0px 0px 0px; }
#bg2 {background: #dddddd; height:2px; margin: 0px 0px 0px 0px; }
</style>

</head>

<div id="bg"> 	</div>
<div id="bg2">	</div>

<body>
  <nav>
    <menu>
       <div id="top"> top menu </div>
    </menu>
    <banner>
       <div id="banner"> banner here </div>
    </banner>
    <menu>
        <div id="menu"> mainMenu</div>
    </menu>
    <breadcrumbs>
    	<div id="pathway"> pathway </div>
    	<div id="separator"></div>
    </breadcrumbs>
  </nav>
  
  <section>
    <div id="content"> content here</div>
    <div id="right"> right content here </div>
  </section>
  
  <ads>
    <div id="ads"> ads here </div>
  </ads>

  <footer>
    <div id="footer"> footer </div>
  </footer>
</body>

Open in new window

0
Comment
Question by:epifanio67
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
sammySeltzer earned 250 total points
ID: 34920553
i don't understand your question though.

See screenshot
untitled.JPG
0
 
LVL 12

Assisted Solution

by:Amick
Amick earned 250 total points
ID: 34920574
It should work now:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- CSS -->

<style type="text/css">
#bg {background: #9E1110; height:4px; margin: 0px 0px 0px 0px; }
#bg2 {background: #dddddd; height:2px; margin: 0px 0px 0px 0px; }
</style>

<style type="text/css">
/*<![CDATA[*/
 div.c1 {margin-left: 2em}
/*]]>*/
</style>
</head>

<body>
	<div id="bg"></div>
	<div id="bg2"></div>
	<div class="c1" id="top">top menu</div>
	<div id="banner">banner here</div>
	<div class="c1" id="menu">mainMenu</div>
	<div id="pathway">pathway</div>
	<div id="separator"></div>
	<div id="content">content here</div>
	<div id="right">right content here</div>
	<div id="ads">ads here</div>
	<div id="footer">footer</div>
</body>
</html>

Open in new window

0
 

Author Closing Comment

by:epifanio67
ID: 34920618
thank you experts....
0
 
LVL 12

Expert Comment

by:Amick
ID: 34920846
I apologize, I may have misunderstood your question.

The code you posted is mal-formed XHTML, but more reasonable HTML 5.  The <div>'s can't legally exist outside the <body> and your browser was making its best attempt at trying to render a reasonable page.  

You may want to see if there's a way to hint HTML 5 for  "< IE9"  browsers in order to help them understand what you intend with that code.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now