Linked Questions
81 questions linked to/from Why can't the <p> tag contain a <div> tag inside it?
83
votes
4
answers
90k
views
Putting <div> inside <p> is adding an extra <p> [duplicate]
From http://webdesign.about.com/od/htmltags/p/aadivtag.htm
In HTML 4, the DIV element cannot be inside another block-level element, like a P element.
However, in HTML5 the DIV element can be found ...
4
votes
2
answers
293
views
Why this "<p><div><br></div></p>" is shown strange in DOM? [duplicate]
When you put <p><div></br></div></p> into body, you will get the strange DOM structure like:
<p></p>
<div></br></div>
<p></p>
...
1
vote
1
answer
209
views
jQuery .html() method closing <p> tag issue? [duplicate]
I'm loading in some html via ajax and inserting it into the DOM. Here is the part of the recieved data, outputted into the console:
<div class="devices">
<h3> Devices </h3>
&...
1
vote
2
answers
1k
views
Paragraph outside div? [duplicate]
This is a problem which is hard to explain without actually showing the problem.
We start off with view-source:
Everything should be inside < p> but instead it closes < p>.
My code:
<p>...
-1
votes
2
answers
852
views
How can I combine tooltip tags and paragraph margin tags in a paragraph? [duplicate]
I'm having problems combining tooltip tags and paragraph margin settings in a paragraph.
This is what I've got at the moment:
.tooltip {
position: relative;
display: inline-block;
...
0
votes
2
answers
707
views
How to vertically align inline element and inline-block element [duplicate]
Say I have the following code
p {
display: inline;
}
div {
display: inline-block;
width: 100px;
height: 50px;
background: black;
}
<p>
Some text
<div&...
0
votes
1
answer
83
views
Understanding Event Bubbling [duplicate]
I am trying to understand event bubbling, while try with my own code:
`
<!DOCTYPE html>
<html>
<body>
<div onclick="alert('1')">
1
...
-1
votes
3
answers
65
views
DIV text formatting inconsistency [duplicate]
I've stumbled upon <div> behavior I've never noticed.
<div> doesn't inherit text formatting styles from the <p> tag. Only from the <p> tag. Even when using class selector.
...
0
votes
0
answers
47
views
Why <div> block is pop out from wrapping <p> using innerHTML? [duplicate]
I've noticed very strange behavior using innerHTML:
var elem = document.body;
elem.innerHTML = '<p> <div> Inner div </div> </p>';
What DOM you expect to see after running ...
0
votes
0
answers
44
views
css selector p > div has no effect [duplicate]
I am trying to restyle div's who reside inside p elements (such are automatically created when using content editable on text). But selector have no effect - div > p works whereas p > div doesn't.
...
0
votes
0
answers
37
views
Background color of the parent block is not [duplicate]
In the code below I have two block elements: p and div. I have two background colors for both the blocks.
Why am I not getting the green background for the whole "p" element?
*{
margin:...
0
votes
0
answers
36
views
<p> tag closing outside containing block in nbconvert template [duplicate]
Ok , I am trying to modify nbconvert template in order to change some style when coverting to html using template , (that I am new to, and it said it's in Jinja template style)
here's the code (of ...
0
votes
1
answer
32
views
When is a new line inserted before a floated element? [duplicate]
I've created a text, and added some left floated boxes to it. But for some reason, they behave differently. The first box breaks the line before it, but the second one doesn't. I don't understand, why....
0
votes
0
answers
22
views
DOMParser().parseFromString() can't parse <p> element correctly [duplicate]
I've encountered an issue when using DOMParser API. I noticed that it parses the <p> tag incorrectly.
var myHtml = '<p><span><div>Hello</div></span><div>World&...
1
vote
0
answers
18
views
Why is a <div> tag or <form> tag written as a child to a <p> tag in an HTML code rendered by Chrome as not a child, but a sibling of the <p> tag? [duplicate]
My markup (form tag can be replaced with div tag):
<p data-id="0">
Please click a button
<form class="box">
<button data-target="choco" onclick=&...