How do browsers display p tags?

QuestionsQuestions8 SkillsProHTML Text FormattingOct, 01 2025
0160

Browsers typically display <p> tags with the following default CSS settings:

  • Margin: Browsers usually apply a default margin to <p> tags, which creates space above and below the paragraph.
  • Line Height: The line height is set to a value that ensures readability.
  • Font Size: The font size is usually set to a standard size, which can vary between browsers but is generally around 16px.

Here’s a simple example of how you might style a <p> tag using CSS:

<style>
p {
    margin: 1em 0; /* Adds space above and below the paragraph */
    line-height: 1.5; /* Increases line height for readability */
    font-size: 16px; /* Sets the font size */
}
</style>

This will ensure that paragraphs are displayed with appropriate spacing and readability in the browser.

0 Comments

no data
Be the first to share your comment!