How would you do borders with opacity in CSS? RGBA colors aren’t working for me…
A JSFiddle is self explaining.
There are dark corners in the border, and the background of the element is visible behind it instead of the other elements behind it.
Thank You.
There might be a better way, but this works:
Live Demo
Basically, just use a wrapper
divwith thergbaset as a background.HTML:
CSS:
Read the comments to this answer to see how to make this method (
rgba) work with older browsers.A way to do it without using a wrapper:
Use
outlineinstead ofborder, it looks acceptable:Live Demo (it’s your exact code, with the one word changed)
(I’m not considering IE here in the slightest)
Check out this article:
http://css-tricks.com/transparent-borders-with-background-clip/