SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    how to make a background accross the screen (width:100%) in a proper way?

    hello everyone,
    i got a few divs in my website that are used to make a background color across the screen with a width of 100%, however the problem is that screens that doesn't see all the content (having a vertical-scrollbar) when they scroll to the sides they'll see uncolored background

    my question is how to make the bg color affect the whole page even when the content is over the viewpoint

    i hope you understood what i mean, im at uni atm so i cannot show any example but i think its easy enough to understand

    thanks,
    ulthane

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,177
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    Presumably your content won't be width 100%, so set a min-width on the color divs so that they can't get smaller than the content.

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,355
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    Yes as Ralph said you will need to set a min-width (in pixels or ems) on each 100% element equivalent to the largest fixed width element it contains. If all containers are within a main parent then addressing the main parent should suffice.

  4. #4
    SitePoint Evangelist
    Join Date
    Jun 2010
    Location
    Israel
    Posts
    523
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    thanks, that solved the issue


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
  •