Grow your CSS skills. Land your dream job.

Resizable Background Images

  • # March 22, 2012 at 10:22 am

    HTML:


    Hello!


    CSS:

    div { width: 70%;}
    h1 {background:url(bg.png) no-repeat;}

    I want to make the background image set on the h1 tag resize and also maintain aspect ratio as the width of the div (which h1 is nested inside) changes. The width of the bg.png is 200px.

    Thanks a lot!

    # March 22, 2012 at 10:42 am

    http://jsfiddle.net/88zbL/2/

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

You must be logged in to reply to this topic.

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