All Posts by Email, Once a Week

Media Temple logo

CSS-Tricks is brought to you in part by Media Temple, the web hosting that we both use and recommend.

fluid with div

  • # May 16, 2009 at 5:36 am

    hi everyone

    can anyone help me in creating a fluid width div whose width changes exactly like the body width…

    thanks

    Nidhin

    # May 16, 2009 at 9:26 am

    if you want the width of the div to be the same as the body all you have to do is not declare a width on the div, it will inherit width from the body.

    # May 16, 2009 at 12:48 pm

    And if you want the div to be 50px from both sides of the screen at all time:

    Code:
    margin: 0 50px;

    And if you want the div to be 5% from both sides of the screen at all time:

    Code:
    margin: 0 5%;

    (Since I just finished doing that, you can see an example (of shameless advertising :D ) here: http://cssvideos.com/)

    # May 16, 2009 at 1:37 pm

    thanks for the help….

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