search

Home  >  Q&A  >  body text

javascript - Why can't the <p> tag be centered in these two methods in html?

ringa_leeringa_lee2732 days ago737

reply all(5)I'll reply

  • 漂亮男人

    漂亮男人2017-07-05 10:42:56

    To center text, use: text-align: center; Just add it to the P tag.

    reply
    0
  • 世界只因有你

    世界只因有你2017-07-05 10:42:56

    Because <p></p> is a block-level element

    reply
    0
  • 高洛峰

    高洛峰2017-07-05 10:42:56

    I guess you have a conflict with the text-align above. The p above contains the p tag

    reply
    0
  • 黄舟

    黄舟2017-07-05 10:42:56

    Just use text-align:center and put it after the font-size attribute

    reply
    0
  • ringa_lee

    ringa_lee2017-07-05 10:42:56

    To center the text, just add text-align:center on P. But if you want the P label to be centered, give p a fixed width margin: 0 auto;

    reply
    0
  • Cancelreply