How to remove space at top of

tag / align contained text to top of container?

前端 未结 2 1263
一向
一向 2021-01-20 22:09

This is undoubtedly a stupid question but i\'m having a bad day and it\'s confusing me!

If you view http://jsfiddle.net/E6kGP/1/ then you can see 2 simple divs next

相关标签:
2条回答
  • 2021-01-20 22:51

    It might be to accommodate accented characters, try putting Ä into the first <p>, the extra space helps accommodate the accent. That said, I'm not 100% convinced that is the definitive reason.

    You can always specifically target the first line of a <p> element to reduce it using:

    p::first-line {
        line-height: 0.8em;
    }
    

    Though granted, that doesnt solve the 'why' issue.

    0 讨论(0)
  • 2021-01-20 23:04

    Like ExtPro has said, it's to accommodate accented characters. A simple work around is to have margin-top:-<number>px; so that you manually align it.

    0 讨论(0)
提交回复
热议问题