I need to know if I can use opacity: 0.01
for hiding my content visually. I need to fade in content on scroll, but if I add opacity: 0
I am not sure how this effects screen readers and SEO. The animation works fine with 0.01 as value.
Do any of you know the answer to this? Thanks
4
Answers
Most Screen Readers will skip content with
opacity: 0
If you want your site to be accessible I can't use this CSS property to load my content in. This is why I was thinking that maybeopacity: 0.01
would work. But I can't find any documentation about this anywhere. Thanks for the answers regarding SEO.When you put the property
, all that happens is that it is still there, meaning in code, in reality, it still takes the space it is supposed to, it can be used to click stuff, all hover effects will work fine, etc. Hence, it does not affect any differently on SEO or screen readers.
is a little different than opacity because it does not take click events. Display: none completely deletes it from the code(not the DOM though), and will affect SEO and screen readers, but that is blackhat SEO techniques which are constantly updated by Google,Bing etc to catch. Hence, display property may or may not affect the SEO, nevertheless it is not recommended at all to use such techniques. You can give an element
and then make it back to 1 with no problems at all.
In general, CSS does not affect screen readers. The only exceptions are:
The first two will hide the elements from the screen reader. The last one can potentially add text to the “accessible name”. See step 2.F.ii in “Accessible Name and Description Computation 1.1“.
Opacity is ignored by screen readers. It’s only changing the appearance of the element and does not remove it from the DOM. You can set it to 0 and a screen reader will still read the element.
I’m not sure where you got that from. I have never seen an element with
opacity:0
skipped by a screen reader.By adding
opacity: 0.01
(or 0) withoutaria-hidden="true"
, your page will fail 1.4.3 Contrast (Minimum): The visual presentation of text and images of text has a contrast ratio of at least 4.5:1So there is no answer for your needs. If you chose to hide from screen, you must hide it from screenreaders.