Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6836431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:21:18+00:00 2026-05-26T23:21:18+00:00

So I have the following html: <html> <head> <style> .box { height: 100px; width:

  • 0

So I have the following html:

    <html>
<head>
    <style>
        .box
        {
            height: 100px;
            width: 100px;
        }       
        #box1
        {
            background-color: Red;
        }
        #box2
        {
            background-color: Red;
        }
        #box3
        {
            border-style: dotted;
        }
        #box4
        {
            background-color: Red;
        }
    </style>
</head>
<body>
<div id="boxes">
    <div id="box1" class="box"></div>
    <div id="box2" class="box"></div>
    <div id="box3" class="box"></div>
    <div id="box4" class="box"></div>
</div>
</body>
</html>

If I change any of the div tags to their single tag version, for example:

<div id="box1" class="box"/>

the subsequent tags become nested, at least in Chrome, Firefox and IE. Does anyone know the deal regarding this behavior? It seems like a bug to me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:21:18+00:00Added an answer on May 26, 2026 at 11:21 pm

    <div> is not a valid self-closing tag in an HTML document. If you’d serve it as XHTML then it should work (if it doesn’t, it’s a browser bug).

    You should also keep in mind that Doctype doesn’t change how the document is interpreted, only mime-type (so it will work if you serve the document with Content-Type application/xhtml+xml) – you can read more here: http://www.webdevout.net/articles/beware-of-xhtml#content_type

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following Code <!DOCTYPE html> <html> <head> </head> <body> <div style=width:200px;height:200px;padding:0px;margin:0px;> <div style=background-color:red;position:relative;display:block;text-decoration:none;padding:0px;margin:0px;> <img
I have the following HTML <html xmlns=http://www.w3.org/1999/xhtml > <head runat=server> <title></title> <style> .box {
I have the following code <html> <head> <title>Test</title> <style type=text/css> <!-- body,td,th { color:
Say I have the following HTML: <head> <style> #container { border: 1px red solid;
I have the following code: <HTML> <head> <style>div{border:dashed 1px silver}</style> </head> <BODY style=background: #fff;>
I have the following HTML: <!DOCTYPE html> <html> <head> <style> #nav { float: left;
I have the following page: <!DOCTYPE html> <html> <head> <style type=text/css> html, body {
I have the following code <!DOCTYPE HTML> <html> <head> </head> <body> <div class=full-details-box name=full_details_box
I have the following HTML: <html> <head> <title> Think in a NEW BOX. </title>
I have the following CSS: html, body { background-color:black; font-family:arial bold; overflow:auto; text-align: center;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.