Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-02-17
4
Medium Priority
?
187 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 29

Accepted Solution

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

See screenshot
untitled.JPG
0
 
LVL 12

Assisted Solution

by:Amick
Amick earned 1000 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
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 different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

972 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