Click here to Skip to main content
13,055,047 members (57,721 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
i am working on c# asp.net web pplication .net 4.5

i used this code to insert background image on webform.
<body background="image.jpg"> </body>

but the problem is that this image is repeated 5 to six time on page.

is there any possibilty to insert the image once on page???

thanks
Posted 6-Oct-12 7:06am
Updated 6-Oct-12 7:08am
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You Can use this Code too : 
<body style="background: url('image.jpg') no-repeat;"></body>
  Permalink  
Comments
safora khan 6-Oct-12 16:29pm
   
thanks. it worked.
would you tell as well that how to specify image size ???
safora khan 6-Oct-12 16:51pm
   
I have solved it, I just increased the actual size of image,
thanks
safora khan 6-Oct-12 17:08pm
   
I did like this

<style type="text/css">
body
{
background-image:url('image.jpg');
background-repeat:no-repeat;
background-size: 100%;
}
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Here is the trick
<style type="text/css">
body
{
background-image:url('image.jpg');
background-repeat:no;
}
</style>


You can also add the style in css instead of inline style.

Hope this helps.
cheers
  Permalink  
v2
Comments
safora khan 6-Oct-12 17:08pm
   
I did like this

<style type="text/css">
body
{
background-image:url('image.jpg');
background-repeat:no-repeat;
background-size: 100%;
}
</style>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 6 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100