Why do paragraphs inherit properties like line-height
and text-align
from the div element?
If values for these properties are:
normal -> for
line-height
[i.e. font-size = 16px (initial / default value) * normal (value is usually around 1.2 -> 19.2 px)]
start -> for
text-align
.
However, the initial values for these properties are overwritten or inherited from the div. Why is this the case? It's confusing to me. At this point, all: initial
works similarly to all: unset
, except for font-size
, which does not inherit from the div.
div {
width: 50%;
font-size: 20px;
line-height: 2;
padding: 20px;
text-align: justify;
background-color: #11a683;
}
p {
all: initial;
}
<div>
<p>
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum...
</p>
</div>