• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 4. Styling Images and Links by Type > What are Attribute Selectors?

What are Attribute Selectors?

We can add type-based styling to the links and images using attribute selectors. Attribute selectors are so powerful and useful because they allow you to target specific elements without needing IDs or classes in the HTML. Instead, attribute selectors target an element based on the existence or value of a specific attribute on that element.

Note

An attribute selector doesn’t have to be used in conjunction with only type selectors. You can use it with any type of simple selector. For instance, .warning[title] combines a class selector with an attribute selector. You can also use it by itself; a selector of [title] would select every single element that has a title attribute on it.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint