HTML CSS examples for CSS Layout:Responsive Layout
Responsive CSS Caption, Mouse Over Image
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> #test {<!--from w w w.j a v a2 s . com--> margin-left:51px; margin-top:51px; position:relative; max-width:501px; height:501px; overflow:hidden; } #image { position:absolute; left:0; top:0; } img { max-width:100%; height:auto; } #caption { z-index:100; position:absolute; color:Chartreuse; font-size:25px; font-weight:bold; left:11px; top:11px; } #caption { display:none; } #test:hover>#caption { display:block; position:relative; top:21; left:21; width:100%; background-color:yellow; z-index:1000; } @media (max-width:600px) { #caption { display:block; position:relative; color:blue; } } </style> </head> <body> <div id="test"> <div id="caption"> Lorem ipsum dolo </div> <img id="image" src="https://www.java2s.com/style/demo/InternetExplorer.png"> </div> </body> </html>