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 4013494
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:22:42+00:00 2026-05-20T09:22:42+00:00

Get an empty HTML, type in this and see its source code on Google

  • 0

Get an empty HTML, type in this and see its source code on Google Chrome:

<p><div>&nbsp;</div>WHY?</p>

If you did it like I did, you’ll see this in the source:

<html>
<head></head><body><p>&nbsp;</p><div>&nbsp;</div>WHY?<p></p>
</body></html>

Just in case, here’s a demo using jsbin. In that link, you see this:

[repeating P]


WHY?
[repeating P]

I’ve added this jQuery on it:

$("p").html("[repeating P]");

Remove the whole <div> from it, and everything goes back to normal. This small weird unexpected behavior is consistent when adding more things in the <div>, and it could be a <span> or I guess whatever in there. And it doesn’t matter if the HTML is well formated or not.

Anyone knows why?

  • 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-20T09:22:43+00:00Added an answer on May 20, 2026 at 9:22 am

    As a basic explanation, div is meant to be a ‘box’ for layout. A box for holding other things. The p element, however, is meant to be for (surprise) a paragraph of text.

    Because a div (container) was put inside a p (inline element), it is (technically) incorrect. Google Chrome (being the standards-slightly-obsessed) browser that it is, it tries to correct this incorrect nesting by adding the extra elements as shown.

    The W3C has a (very long) article about these language specifications on their site, however possibly the best thing to do to check for inconsistencies and potential problems like this is to Validate your written source code. The easiest way to do this is with the W3C Validator.

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

Sidebar

Related Questions

$(function() { setInterval(function() { $.get(refresh.php, function(result) { $('#response').empty() .hide() .html(result) $(#response).append(result) .fadeIn(slow); }); },
$new = $this->memcache->get(posts); if(empty($new)){ // Get the new posts $new = Posts::getNow(10); // Save
I get the error Data Source cannot be empty. Use :memory: to open an
If I don't include the stdafx even in an empty .cpp, I get this
This is what I'm trying: $.ajax({ type: 'GET', url: 'http://imgur.com/upload/', data: { url: 'http://upload.wikimedia.org/wikipedia/commons/3/3e/Phalaenopsis_JPEG.png'
I have this code: <input type=hidden id=editorTitle name=title value=home> <textarea name=text id=editorText></textarea> But when
I have the following file: <html> <head> <title></title> <link rel=css type=text/css href=/empty.css title=css />
I have this code: $reader = new DOMDocument(); $reader->loadHTML($shell); $xpath = new DomXPath($reader); $xpath->registerNamespace('html','http://www.w3.org/1999/xhtml');
While generating an XML content, I get an empty node <node/> , and I
Whenever the tags argument is not empty I get a NotSupportedException: Local sequence cannot

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.