How to select elements with a specified attribute with CSS

CSSWeb DevelopmentFront End Technology

To select elements with an attribute, use the CSS [attribute] selector.

For example, alt attribute or a target attribute, etc.

You can try to run the following code to implement the CSS[attribute] selector,


Live Demo

<!DOCTYPE html>
         img[alt] {
            border: 3px solid orange;
      <img src = "" height="200" width="200">
      <img src = "" height="200" width="200" alt="Tutorials Library">
Updated on 23-Jun-2020 16:09:58