HTML CSS examples for CSS Widget:Image
Changing background image is not responsive
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .container {<!--from w ww .j a v a 2 s . c o m--> width:601px; height:601px; } .container img, .top { max-width:100%; max-height:100%; } .top { width:601px; height:401px; -webkit-transition:background-image 0.6s; display:block; } .top:before { content:""; background-image:url('https://www.java2s.com/style/demo/Google-Chrome.png'); background-repeat:no-repeat; background-size:cover; background-position:center; -webkit-transition:background 0.6s; width:100%; height:100%; display:block; } .container:hover .top:before { content:""; background-image:url('https://www.java2s.com/style/demo/Google-Chrome.png'); -webkit-transition:background 2s; width:100%; height:100%; display:block; } </style> </head> <body> <div class="container"> <div class="top"> </div> </div> </body> </html>