Monday, September 20, 2010

Transparent Borders with background-clip


The Opacity declaration sets how opaque an element is. An opacity value of 1 means the element is fully opaque; an opacity value of 0 means an element is not at all opaque, i.e. fully transparent.



Try with the below css code:

background-color: white;

-moz-background-clip: padding;
-webkit-background-clip: padding;
background-clip: padding-box;

border: 20px solid rgba(205,131,25,0.3);

-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;

padding: 25px;

text-align: center;

position: absolute;
top: 50px;
left: 500px;

--------------

The background-clip property is used to determine whether the backgrounds extends into the border or not.

-moz-background-clip: padding; -> Firefox 3.6
-webkit-background-clip: padding; -> Safari 4? Chrome 6?
background-clip: padding-box; -> Firefox 4, Safari 5, Opera 10, IE 9

The RGBA declaration allows you to set opacity (via the Alpha channel) as part of the color value.
border: 20px solid rgba(205,131,25,0.3);

Browser support :

-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;

padding: 25px;
text-align: center;
position: absolute;
top: 50px;
left: 500px;