0

If I set have the following HTML:

<p>line 1</p>
<p>line 2</p>

With no CSS changes it is rendered like this:

line 1

line 2

but if I set the css to p { display: inline; }, it renders like this:

line1line2

Which makes sense. If I set the css to p { display: initial; } I'd expect it to return to block-style rendering but they're actually rendered inline.

Why is that?

  • initial of display is inline .. it's not the default browser style – Temani Afif Feb 05 '20 at 17:20
  • In the first CSS spec (CSS1), the initial value for display was block. In CSS2, the initial value for display was changed to inline. Browsers chose to keep the default as the original CSS1 initial, probably for backwards compatibility. https://www.w3.org/TR/CSS2/visuren.html#display-prop – Brennen Sprimont Feb 05 '20 at 17:26
  • @BrennenSprimont no, browsers are considering the CSS2 and inline as value for initial. – Temani Afif Feb 05 '20 at 17:27
  • @TemaniAfif ? I think you misread the comment. Rephrasing it a bit, in CSS2 the display initial was changed to inline but browsers chose to keep their defaults as the CSS1 initial (block). – Brennen Sprimont Feb 05 '20 at 17:35
  • @BrennenSprimont The default/initial value for browsers is inline. Only some element are defined to be block element like div, p while other are inline like span, i. Technically there is no default value but values speficied for different elements and initial is inline in all the cases. – Temani Afif Feb 05 '20 at 17:40
  • @TemaniAfif I suppose I should have added "for the paragraph element" (what this question was asking about) to my comment. – Brennen Sprimont Feb 05 '20 at 17:51

0 Answers0