SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Feb 2010
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to stretch a DIV to full width of browser ?

    I want a div to be stretched fully to 100% width of a browser. I made the width to 100% but still there is some blank space is there. Here i have attached the link to image.. i want the image to be fully stretched. Let me know how to do this..

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Your image doesn't seem attached, but is it possible that a default body margin is affecting the full width?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2010
    Posts
    56
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It could be the default body margin or you might be putting in a div that you set a width to already. Check those both out then post back.

  4. #4
    SitePoint Enthusiast drewhoward's Avatar
    Join Date
    Jan 2010
    Location
    Toronto
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think just setting the body margin to 0 should do it:

    body
    {
    margin: 0;
    }

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Location
    Greenville, South Carolina, United States
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    .div {
    width: 100%;
    }

    But as you mentioned, did not work. Make sure the Div is outside of any containers (ie, a page container with a width of say 800px).

    In addition, try to set the margin:auto; and the width:100% to see if that fixes it.
    Phase 8 Facebook Applications and Web Development


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •