SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Line spacing

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Line spacing

    As in my previous post I am starting to play around with CSS. When I use the h1, h2 tags etc with CSS I seem to get big spaces between lines of text.

    I've tried coding the opening and closing tags all on one line, changing line height and just about everything else I can think of, but I just can't seem to get one row to follow another without big gaps. Does anyone know why this is happening?

  2. #2
    jigga jigga what? slider's Avatar
    Join Date
    Oct 2002
    Location
    Utah (USA)
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The default settings on these tags include margins. If you want to change or eliminate the spacing these tags cause you just alter the margin settings in your style definitions.
    $slider = 'n00b';

  3. #3
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    Headings H1 through H6 haves "built-in semantics" and it is usual to collapse vertical white space between block flow objects, e.g. <p>, <h1> through to <h6>

    The heading element has its own rules for collapsed space and is a block element thus h1 spacing will differ from h2 spacing according to the built in semantics.

    When you come down to it Headings have a different quantity of white space assigned to them relational to their level, i.e. 1, 2, 3, 4, 5 or 6.

    Hence why if you apply some CSS like: h1 {margin-bottom: 10px;} in a fairly CSS compliant browser like Mozilla it overrides the bottom "space value", i.e. margin.

    In the above example, the h1 has it bottom margin fixed at 10px, thus leaving a 10px space underneath the h1, similar methods can be applied to 'alter' the white space above the heading.
    Last edited by xhtmlcoder; Nov 8, 2002 at 04:24.


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
  •