Can we have two body tags on a .html page?

 Posted by Ddd on 2/19/2011 | Category: HTML 5 Interview questions | Views: 68416 | Points: 40

Yes, we can have 2 body tags on a .html page

<body bgColor="lightblue">
<body bgColor="lightgreen">

//output: the backcolor of the body will be lightblue,
//but the headers of both the body tags will be visible in the output.

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Mkiran on: 7/6/2011 | Points: 10
What is the use of this. In .html page we can re use any tag. If you place any tag more than one time, it does not show any error. So from my opinion, answer for this question is No.
Posted by: Akiii on: 7/11/2011 | Points: 10
There may be any number of body tags in a html file but only the first and the last one is considered.

<body bgcolor="lightblue">


Try using the firebug and see the difference..
Let me know if there is any problem you face...

Nice question though...
Thanks and Regards

Login to post response