by skyvia
5 replies
  • WEB DESIGN
  • |
How do I fix the line height in css. i.e. I have a header, under it (with very litle space between the lines) I want a text. The header is a H1 and the text under is unspecified, but the font size differ.
#css #line #problem
  • Profile picture of the author Kezz
    There three things you need to consider:

    line-height
    margin
    padding

    And you might need to specifically set all three on both your h1 and the p tag for your text. Both h1 and p tags naturally have some default padding and margin so you may need to set those to the desired amount to get the layout you're after.
    {{ DiscussionBoard.errors[3485123].message }}
  • Profile picture of the author Bob Phantom
    Why not try to insert the H1 tag in a div and move it freely like you want to?
    {{ DiscussionBoard.errors[3485610].message }}
    • Profile picture of the author ronc0011
      You can adjust placement and spacing using margins. Margins will accept negative values i.e. "-10px"
      {{ DiscussionBoard.errors[3487171].message }}
  • Profile picture of the author kjhosein
    You can even specifically style a p that follows an h1 directly like this:
    Code:
    h1 + p { }
    this would not affect other p tags unless they immediately followed an h1.

    @bob - I would recommend against inserting the h1 into a div when all @ronc0011 wants to do is adjust the spacing around the h1 element.

    +1 for @kezz's suggestions as well.

    HTH!
    Signature
    <!--PM me for a quicker reply. Thx!-->
    {{ DiscussionBoard.errors[3491214].message }}
  • Profile picture of the author zaminur143
    Originally Posted by skyvia View Post

    How do I fix the line height in css. i.e. I have a header, under it (with very litle space between the lines) I want a text. The header is a H1 and the text under is unspecified, but the font size differ.

    Well I had similar type of question to get answer, but now I've got it.Thanks buddy.
    {{ DiscussionBoard.errors[3491264].message }}

Trending Topics