Solved

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

Posted on 2011-02-17
4
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 29

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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 …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

632 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