How to select elements by inline style attribute with CSS?

Spread the love

Sometimes, we want to select elements by inline style attribute with CSS.

In this article, we’ll look at how to select elements by inline style attribute with CSS.

How to select elements by inline style attribute with CSS?

To select elements by inline style attribute with CSS, we use the attribute selector.

For instance, we write

div[style*="display: block;"] {
  //...
}

to select the divs with the style attribute that includes display: block;" as its value.

Conclusion

To select elements by inline style attribute with CSS, we use the attribute selector.

Leave a Reply

Your email address will not be published. Required fields are marked *