10

this line of code is for the navigation bar of Apple.com

#globalheader #globalnav[class*="nosearch"] { width:100%; }

Somebody know what that asterisk after class means there?

Kaii
  • 20,122
  • 3
  • 38
  • 60
Luis Rivera
  • 487
  • 3
  • 12

2 Answers2

29
#globalnav[class*="nosearch"]

means: class contains "nosearch"


#globalnav[class^="nosearch"]

means: class starts with "nosearch"


#globalnav[class$="nosearch"]

means: class ends with "nosearch"


Reference: http://reference.sitepoint.com/css/css3attributeselectors

Aziz
  • 20,065
  • 8
  • 63
  • 69
  • 1
    `#globalnav[class*="nosearch"]` is the same as `#globalnav.nosearch`. Isn't it? – DanielBlazquez Aug 08 '13 at 18:26
  • 2
    @Dani: Nope. The first would include any class that has the string `nosearch` in its name, such as `boxnosearch` and `nosearchbutton`. The second would include only the class `nosearch` and nothing else. – Aziz Aug 13 '13 at 02:19
0

* is very similar to ~ but ~ matches only with space around it.

E.g.

foo bar

but not

foo-bar

* will match both.

Nelu
  • 16,644
  • 10
  • 80
  • 88