开发者

transparent borders with css 3

Is there a way to make the borders of an el开发者_JAVA百科ement semi-transparent? using purely css? like the modal window that facebook uses?


You can use rgba() such that background-color: rgba(255,0,0,0.5); is the same as background-color: rgb(255,0,0); opacity: 0.5;

For your border, do something like this border: 3px solid rgba(255,0,0,0.3);

http://jsfiddle.net/robert/b3e3v/


RGBA is only half of an answer, the other half is background-clip. See there: http://css-tricks.com/transparent-borders-with-background-clip/


Use two divs ... one for the border the other for the inner area. Then set the background color of the outer div to have a transparency value:

background-color:rgba(0,0,0,0.5);


Well, you can do it in a hackish manner. Here is an article on how to make transparent/semi-transparent borders around a header section:

Transparent borders


<div id="lightbox">
/* Set transparent background with PNG
   add padding to push inside box inward */

  <div id="lightbox-inside">
    /* Set white background in here */
  </div>

</div>

2 divs means proper compadibility. just remember to set your opacity(for ie and all others respectively)


Yes you can achieve that very easily! Use this code :

border: 14px solid rgba(0,0,0,0.50);

Where 0.50 is the opacity!

Hope it helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜