Create a border outside from a width-specified element - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Border Style

Description

Create a border outside from a width-specified element

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">

body{<!--from  ww  w . j  av a  2 s.  c  om-->
   background: red;
}
#element {
   width: 350px;
   border: 5px solid rgba(0,0,0,0.2);
}
#element2 {
   width: 350px;
   border: 5px solid rgba(0,0,0,0.2);
   box-sizing: border-box;
}


      </style> 
 </head> 
 <body> 
  <div id="element">
    test content 
  </div> 
  <br> 
  <br> 
  <div id="element2">
    test content 
  </div>  
 </body>
</html>

Related Tutorials