picture as backround

vagelis

Member
Joined
Nov 7, 2009
Messages
8
Programming Experience
Beginner
i want to have a picture as backround for a page

with this html code

<body background="gallery/laos-aerodromio.jpg">

the picture comes in multi times as a small picture

i want the picture to comes in one time and to cover all the page even if the page resizes and get bigger vertical or closes in

can be that done??
 
Stretch background image using CSS

You can't achieve that in that way. Means there is no way to stretch or control the size of a background image using css or HTML. Rather you need to use a little trick.


PHP:
Expand Collapse Copy
<head runat="server">
    <title>Stretched Background Image</title>
    <style type="text/css">
    body 
    {
        overflow: scroll;
    }
    .theimage 
    {
	    width: 100%;
	    position: absolute;
	    top: 0;
	    left: 0;
	    z-index: 1;
    }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div style="position:absolute; left: 20px; top: 20px; z-index: 2;">        
        Some Content here ... 
    </div>
    <img class="theimage" src="images/image.jpg" alt="my image" />
    </form>
</body>

Now the image.jpg will be stretched no matter its original dimension ;)
 
Back
Top