HTML CSS examples for CSS Layout:Box
have a box increase its size based on its content
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .box {<!-- w w w .j a v a 2 s. c o m--> overflow:hidden; background-color:Chartreuse; display:inline-block; } img { padding:11px; } </style> </head> <body> <div class="box"> <img src="https://www.java2s.com/style/demo/Opera.png"> </div> <br> <div class="box"> <img src="https://www.java2s.com/style/demo/Firefox.png" style="width:200px; height:200px;"> </div> <br> <div class="box"> <img src="https://www.java2s.com/style/demo/Opera.png" style="width:75px; height:75px;"> </div> </body> </html>