Click here to Skip to main content
15,902,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi.
i have a "div" element in my html page.the "width property" of div is based on percent e.g "width:80%",i wanna set a image to div's background property.
i have a image that its width is 1000px so i wanna image width change with width of div.
so how i do it?

thank.
Posted

1 solution

How about you use the background-size property?

You can have the background either stretch, tile or neither. Look into the 'cover', 'contain' and '100%' values for this attribute.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900