Grow your CSS skills. Land your dream job.

[Solved] h2 Acting Like an Inline Element

  • # November 30, 2009 at 2:14 pm

    I’m trying to add top and bottom margins to an h2 tag. For whatever reason, it refuses to behave.

    *note, h2′s are refusing to accept styling universally, not just in the html example I posted.*
    *h2′s accept all styling except padding and margins*

    Here’s the CSS

    Code:
    h2 {
    font-family: Georgia, Palatino, ‘Palatino Linotype’, Times, ‘Times New Roman’, serif;
    font-size: 1.5em;
    line-height: 1.25
    margin-top: 1.25em;
    }

    Here’s the HTML

    Code:

    About Us

    Sierra Technology Group is a Reno based computer technology and network consulting firm. The company is currently owned by its founder, Darren McBride, a UNR graduate in electrical engineering. The company began as “Sierra Computer Control” in 1982, and was originally engaged in computer hardware and software design. Mr. McBride spent 4 years doing much of the pioneer work in the field of English/Arabic computing for various Middle Eastern governments. In 1987, the company focused their business model on the resale of computer equipment and services in Northern Nevada. Since then, Sierra Computers Ltd. doing business as Sierra Technology Group, has achieved sales growth from 10% to 20% per year every single year.

    Contact Us

    1900 Vassar Street
    Reno, NV 89502
    (775)-322-6455
    info@sierra-computers.com

    Thanks

    # November 30, 2009 at 2:21 pm
    Code:
    h2 {
    font-family: Georgia, Palatino, ‘Palatino Linotype’, Times, ‘Times New Roman’, serif;
    font-size: 1.5em;
    line-height: 1.25
    margin-top: 1.25em;
    }

    You are missing a semi-colon after "line-height:1.25".

    # November 30, 2009 at 2:22 pm

    It sounds like you have more CSS which is overwriting your padding/margin.

    Do you have a live link? Or can you copy all of your CSS for us?

    # November 30, 2009 at 2:23 pm

    Nutz, he’s faster and *righter* ;)

    # November 30, 2009 at 2:43 pm

    Wow, the hilarity never stops. That was spectacularly stupid. Sorry I bothered you all.

    # November 30, 2009 at 3:11 pm
    "jinfiesto" wrote:
    Wow, the hilarity never stops. That was spectacularly stupid. Sorry I bothered you all.

    Those ones can be particularly hard to spot. I was in the middle of replying the same thing that Ashton had written, except my eye caught it just as I was about to hit submit.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".