Margin+padding compensate - HTML CSS CSS Property

HTML CSS examples for CSS Property:padding

Description

Margin+padding compensate

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">
a {<!--from  w ww  .ja va2 s . c  o  m-->
   text-decoration:none;
}

a:hover {
   color:Chartreuse;
   background:lightblue;
   padding:0.4em;
   margin:-0.4em;
}

a.box {
   display:inline-block;
   border-right:solid yellow;
}
</style> 
 </head> 
 <body> 
  <p>Lorem <a href="#">Lorem ipsum</a>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcor</p> 
  <p>Lorem <a class="box" href="#">Lorem ipsum dolor sit amet, consec</a>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>  
 </body>
</html>

Related Tutorials