CBeTJlu4ok
CBeTJlu4ok

Reputation: 1112

What do this CSS selectors do

I'm developing some project on bootstrap, where I encountered some problem with one class.

.nav-pills > .active > a > [class^="icon-"],
.nav-pills > .active > a > [class*=" icon-"],

can you give me some link where I can find some information about this class^/*. It gets my code messy and you know how it's hard to google with those symbols and class keywoard )

Upvotes: 0

Views: 64

Answers (1)

Jan Hančič
Jan Hančič

Reputation: 53929

This is called a CSS attribute selector. You can read all about them here: https://developer.mozilla.org/en-US/docs/CSS/Attribute_selectors

In your case [class^="icon-"] matchs elements whose class attribute starts with icon- followed by whatever. And [class*=" icon-"] matches elements who have icon- anywhere in the class attribute (mind the space at the beginning).

Upvotes: 2

Related Questions