Gabriel is going wrong because pseudo-element ::after
is inheriting the font-size
from the father who is 0, so you have to put a font-size
pro ::after
or else it will be 0 like the father his.
See how it feels when you fix it by putting the font-size
in the son. The text of the father disappears, but the text of the son remains.
OBS: Notice I put a color
text on the father, and the text of the son (::after
) remains the same, so he inherits some attributes from his father, as was the case of font-size
.service {
font-size: 0;
color:red; /* cor de texto que o filho ::after vai herdar */
}
.service::after {
content: " de Transfer";
font-size: 16px !important;
}
<label for="" class="service">
texto que some
</label>
Keep in mind that: the user may not even see the text we hide with font-size: 0
, but the Google Bot will definitely read this content... It will solve so that you see with your eyes, but for the crawlers and screen readers the text will remain accessible...
Good morning friend! vlw the tip, but "font-size" is returning as "invalid Property value". Even "color" is invalid. What could be?
– Gabriel Salomão
@Gabrielsalomão I just did the test in the CSS validator of the W3C itself and did not accuse any error: http://www.css-validator.org/#validate_by_input and in the Chrome Devtools Console nothing appears either, but if you used the Audits tab you may have given some warning, because there they evaluate the usability and accessibility and font-size:0 goes against this, so it remains the observation for you to bear in mind this issue
– hugocsl