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

  • SEARCH
  • Home
  • 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 6151545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:46:57+00:00 2026-05-23T19:46:57+00:00

I am trying to understand why is there a difference in how a browser

  • 0

I am trying to understand why is there a difference in how a browser displays <div></div> verses <div />?

Here is an example: The expected output of snippet #1 is three boxes, side by side: [black], [blue], [red]. Snippet #2 only displays [black] and [red] – Why isn’t the [blue] box rendered in snippet #2?

1:

<div style="float:left; width:50px; height:50px; background:black;"></div>

<div style="float:left; width:50px; height:50px; background:blue;"></div>

<div style="float:left; width:50px; height:50px; background:red;"></div>

2:

<div style="float:left; width:50px; height:50px; background:black;"></div>

<div style="float:left; width:50px; height:50px; background:blue;" />

<div style="float:left; width:50px; height:50px; background:red;"></div>

Edit: I am using Chrome 12 & html5: <!doctype html>

  • 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-23T19:46:57+00:00Added an answer on May 23, 2026 at 7:46 pm

    Mainly because <div /> is not valid HTML.

    If you have a look through the different doctypes you’ll notice that div cannot be self closing.

    According to the W3C:

    A div element must have both a start tag and an end tag.

    Source: http://www.w3.org/TR/html-markup/div.html

    To include Chucks comment here also, a trailing slash in HTML does not a self closing tag make. Self closing tags using a trailing slash are a feature of XHTML, not HTML.

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

Sidebar

Related Questions

I'm trying to understand the difference between sequences and lists. In F# there is
I am trying to understand this example code regarding Browser Helper Objects. Inside, the
I am trying to understand how to use reference parameters. There are several examples
I am trying to understand the difference between message-oriented and stream-oriented protocols. I've searched
I was trying to understand the difference between closures and function pointers, and I
Possible Duplicate: Difference between Covariance & Contra-variance I'm trying to understand what covariance and
I'm trying to understand the difference between Ruby threads pre-1.9 and 1.9 (in the
I am trying to understand the difference between __getattr__ and __getattribute__ , however, I
I am trying to understand the difference between memcpy() and memmove() , and I
I've been trying to understand the difference between JavaScript's comparison operators: identity and equality.

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.