« Web, HTML, Tech Forum

Alt text question

Obligatory disclaimer: I am completely clueless about those things have mercy pls

Currently trying to add alt text accessible to screen readers, but not visually shown on my page, if that makes sense. Would the following work or nope?

.body {

    content: url(...);

}

.body::after {

    content: "Alt text";

    display: none;

}


Report Topic

1 Reply

Reply by KotsuCoder

posted

Alt text is an attribute in the HTML <img> tag. Is there a specific reason you're trying to add alt text via CSS? Why not just add the image with HTML?


Report Reply