Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS Opacity 0 vs 0.0001

Tags:

css

I noticed on github that they use opacity of 0.0001, rather than 0, on certain elements they want to make transparent. Why is that?

like image 834
alnafie Avatar asked Mar 25 '13 07:03

alnafie


People also ask

What does opacity 0 mean in CSS?

The opacity property sets the opacity level for an element. The opacity-level describes the transparency-level, where 1 is not transparent at all, 0.5 is 50% see-through, and 0 is completely transparent.

Does opacity 0 affect SEO?

Not sure what you mean by screen readers, but if you are worried about SEO then no, opacity will not affect SEO.

Is opacity 0 the same as display none?

As you can see, whenever you need the element to disappear completely and not take up any space, you should use display: none; . If you want the element to have a transition or fade-in effect when becoming visible, you should use opacity: 0; .


1 Answers

If you set opacity to 0, it disappears from the page. But if you set opacity to 0.0001, it's still on the page (just "very hard to see") and it keep it's functionality (e.g. click etc).

like image 77
Pavel Štěrba Avatar answered Oct 21 '22 00:10

Pavel Štěrba