html - Any way to set CSS background size to be 100% of image size but not more than 100% of container size? -


i've got large div users can swap out backgrounds either patterns or own images. small background images not sized cover entire div, want images repeat horizontally , vertically , not stretch on 100% of natural width. larger images cover more width of div, want limit not stretch beyond 100% of div width entire width of image visible.

is there way accomplish without using javascript?

plunker here:http://plnkr.co/edit/pkx49a3ku34ysupqlcrs?p=preview

#background1 should repeat is

#background2 should not stretch beyond 100% of container width

to clarify, i'm looking solution doesn't involve js , work both cases (can't add styling specific element)


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -