html - Resizeable div with background image -


i have div background image:

<div id="mydiv">    ... </div>  #mydiv {    background-image: url(...);    width: 70%;    max-width: 200px; } 

now, want background image resized fit div. this, added background-size: 100%. solves problem regarding width, height accomodates content of the, , since content of div smaller, image cropped in bottom. should set height attribute follows resizing of width?

if understand well, want background streched , fit exactely div. in case, try set both values of background-size property in way:

background-size: 100% 100%; 

Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -