Grow your CSS skills. Land your dream job.

[Solved] Creating a dynamic underline for a heading

  • # January 20, 2010 at 7:11 pm

    I am working on a design and want to create an underline background for a heading which can expand or shrink depending on the heading.

    [img]http://demowebsite.co.nz/heading.png[/img]

    The code for the heading is <h1><img(the stars in front which is inserted using jQuery)/>The Wahine Disaster<img(second stars at right)/></h1> . What is the best way to do this?

    # January 20, 2010 at 9:54 pm

    You can actually apply a background to H1 elements. You can style them just like you would a div.

    # January 21, 2010 at 4:57 pm

    How do I get the H1 to fit tight to the text and also center the heading in the middle of the page?

    # January 21, 2010 at 5:03 pm

    I’m not sure what you mean by "fit tight to the text", but you can apply a height to h1.

    Do you have a link of where you’re working on it?

    # January 21, 2010 at 5:14 pm

    FIXED!!!

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

You must be logged in to reply to this topic.

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