SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Location
    Melbourne, Australia
    Posts
    46
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    How to adjust paragraph spacing?

    Hi all,

    I know you can adjust the spacing between lines of text with the 'line-height' property, but how do you adjust the spacing between different paragraphs? Do you use the margin-top and/or -bottom property?

    For example, if I have

    HTML Code:
    <style type="text/css">
    		body{
    			font-family:Helvetica, Arial, sans-serif;
    			text-align:center;
    			color:#939598;
    			line-height:150%;
    			font-size:13px;
    		}
    		h1{
    			font-size:26px;
    			font-weight: bold;
    			color:#2755A1;
    			line-height:100%;
    		}
    </style>
    <body>
    <p>introductory line</p>
    <h1>heading</h1>
    </body>
    ...the spacing between the <p> element copy and the <h1> copy feels enormous. Can I reduce it using the style adjustment below? Any potential issues I should be aware of?

    HTML Code:
    		h1{
    			margin:-10px 0 -10px 0;
    		}

  2. #2
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,657
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Use bottom margin. Better than padding as it calapses

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2012
    Location
    Melbourne, Australia
    Posts
    46
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the confirmation, @EricWatson!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •