The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Programming Fundamentals" Dec 02 - 2:00 PM Eastern

Set Image to Auto Fit the page width

  • # March 31, 2013 at 12:17 pm


    I would like to get the images fit to the current page width.

    As you can see here: the images are over the page width.

    I would like to make them to fit into the windows as they resize as well.

    How can I do that?


    # March 31, 2013 at 12:53 pm

    This reply has been reported for inappropriate content.

    img { width: 100%; }

    # March 31, 2013 at 1:25 pm

    Not sure that will work.

    # March 31, 2013 at 10:19 pm

    You have this applied to your media query:

    img {
    max-width: 100%;
    height: auto;

    But you only have that applied to your smaller size, that’s why the bigger version breaks out.

    Having said that, you’d probably want to not use a table and make a bunch of other changes.

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

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed