Tutorials
Start Learning
Learn HTML
Learn CSS
Learn JavaScript
TUTORIALS
THE WORLD'S LARGEST WEB DEVELOPER SITE
Edit & Run
<!DOCTYPE html> <html> <head> <style> .div1 { border: 1px solid black; height:150px; width:180px; background:url(img_flwr.gif); background-repeat: no-repeat; } .div2 { border: 1px solid black; height:150px; width:180px; background:url(img_flwr.gif); background-repeat: no-repeat; background-size: contain; } .div3 { border: 1px solid black; height:150px; width:180px; background:url(img_flwr.gif); background-repeat: no-repeat; background-size: cover; } </style> </head> <body> <p>Original image:</p> <div class="div1"> <p>Lorem ipsum dolor sit amet.</p> </div> <p>Using the "contain" keyword:</p> <div class="div2"> <p>Lorem ipsum dolor sit amet.</p> </div> <p>Using the "cover" keyword:</p> <div class="div3"> <p>Lorem ipsum dolor sit amet.</p> </div> </body> </html>
Top Tutorials
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
Top References
HTML Reference
CSS Reference
JavaScript Reference
Top Examples
HTML Examples
CSS Examples
JavaScript Examples
Web Certificates
HTML Certificate
CSS Certificate
JavaScript Certificate