SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS Background Image question

    Ok, I don't know if this is possible but I figured I would ask.

    Is it possible to only show a background img/parts of a background img depending on a user's browser resolution? This background is NOT repeatable so I can't use the repeat x trick. But here is a sample scenario of my problem.

    I have a background img of approx 1280 x 1024. The actual content of the site is approximately 1024x768. So I want my minimum size to be 1024x768 so that if a user's browser size is 1024x768 or larger there will be NO scroll bars showing, but if the user's browser resolution is higher than that, I want to show parts of the background or whole background (if the browser size is that size or larger).

    Right now when I put the background img in a body or div tag...the browser will think that the website is actually 1280x1024 even though the real content is only 1024x768 therefore, if a browser window is only 1024x768 it will show scroll bars

    Any help would be greatly appreciated!!!

  2. #2
    Resident curmudgeon bronze trophy gary.turner's Avatar
    Join Date
    Jan 2009
    Location
    Dallas
    Posts
    990
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you want a background image, put it in the background.
    Code:
    body {
      background: white url(some.png) no-repeat;
      }
    cheers,

    gary
    Anyone can build a usable website. It takes a graphic
    designer to make it slow, confusing, and painful to use.

    Simple minded html & css demos and tutorials

  3. #3
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow...I can't believe I wrote a post for that haha. I thought I tried that and was getting scrollbars...turned out it was from another element.

    Thanks!


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
  •