tags:

views:

49

answers:

4

Hello,

I want to display an image of 1920x1170 pixel / 183KB as a background image, here is my code

.bground{
      height:auto;
      left:0;
      position:fixed;
      top:0;
      width:100%;

   }


<div class="bground" style="left:0px;">
<img src="Untitled-2.jpg" />
</div>

It displays the image alright, but the problem is that I can see only half the image, not full. And when I right click, the menu says save image as, copy image, copy image url. I expect reload page...etc....

How do I correct it.

Thanks Jean

A: 

Your CSS is incomplete, and you probably should set the image as background image (not sure, you're not giving more detail about your situation). Try

.bground{
      height:auto;
      left:0;
      position:fixed;
      top:0;
      bottom: 0;
      right: 0;
      background-image: url(Untitled-2.jpg);
      background-position: left top; /* Adjust to liking */
      background-repeat: no-repeat;
   }

<div class="bground">
&nbsp;
</div>
Pekka
Display is the same.
Jean
@Jean can you add a screen shot or live link to your question? Also, your screen resolution is 1920 x 1170 Pixels or more, right?
Pekka
Any way to upload the image here, so you get the feel of what I am trying to say
Jean
@Jean not here directly, no... Do you want to *scale* the image to your screen size?
Pekka
@pekka, yes I want to according to screenszie 15.6" or 26".
Jean
A: 
hmtl, body { height: 100%; width: 100% }
.bground {
    width: 100%;
    height: 100%;
    background: url(Untitled-2.jpg) no-repeat center center;
}

<div class="bground">
</div>

Your image was probably cut because <html> was not taking all the screen space.

Razor
I tried with html height 100% and width:100% does not work
Jean
You have to add height and width to HTML and BODY too.I verified and it works, so if it doesn't for you, then there's another problem and you should give us more details.A live page would be best.
Razor
The image is 1920x1170px, and using your code, the image is not displayed either
Jean
A: 

hmtl, body { height: 100%; width: 100% } .bground { width: 100%; height: 100%; background: url(Untitled-2.jpg) no-repeat center center; }

this is right answer .........

Prashant
Its not the right answer, try the code yourself.
Jean
+3  A: 

You can use CSS3 media queries to scale background images: http://www.alistapart.com/articles/supersize-that-background-please/

kingjeffrey
The linked article also mentions a couple of workarounds using the `img` tag for older browsers.
devstuff
+1 Nice article
What