:target {
border: 2px solid #D4D4D4;
background-color: #e5eecc;
}
.navigation li {
list-style-type: none;
float: left;
padding: 1em;
}
<ul class="navigation">
<li> <a href="#help"> Help </a>
</li>
<li> <a href="#about"> About us </a>
</li>
</ul>
<p>lorem ipsum</p>
<br/>
<p id="help"><b> Help yourself man </b>
</p>
<p id="about"><b> We're free software lovers </b>
</p>
If we inspect the above snippet (using dev tool) ul
and p
elements both are display:block
under user agent stylesheet. Nothing is applied in element.style
and none of them have float:left
Yes, the float
is applied to li
not ul
and removing float:left
from .navigation li
class will fix the problem.
p
and ul
both are block elements then why they're behaving as inline elements? Not adding a new line break.
I'm not looking for a fix, I need to understand the concept behind this.