Use image as background - HTML CSS CSS Property

HTML CSS examples for CSS Property:background

Description

Use image as background

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">

div {<!--from   www  .j  a v  a 2  s  .co m-->
   width:300px;
   height:300px;
   padding:50px;
   background-image: url('https://www.java2s.com/style/demo/Safari.png');
   background-repeat: no-repeat;
   border: 10px solid rgba(255, 170, 170, .5);
}


      </style> 
 </head> 
 <body> 
  <div></div>  
 </body>
</html>

Related Tutorials