1

Reviewing Zappos.com's source, I noticed they have many html elements using class names like:

class='gae-click*-*Promos*Join-Zappos-Rewards-Earn-Points-Get-Free-Expedited-Shipping-and-more-Learn-More- images '

I know asterisks can be used in css files themselves, for selectors, but I'm unfamiliar with this on page elements.

Is it a wildcard or something? Or is it just the name of a single class?

BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
SnakeDoc
  • 13,611
  • 17
  • 65
  • 97

3 Answers3

1

As per HTML5 rules, an asterisk is an acceptable value for the class attribute.

Here's a complete explanation: HTML5: Permitted Values for ID & Class Attributes

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
1

The class gae-clickGlobal-Header-zapposheaderPromos*Join-Zappos-Rewards-Earn-Points-Get-Free-Expedited-Shipping-and-more-Learn-More- images

is attached to an image element in the (potentially global) header with an alt tag (and title) of Join Zappos Rewards: Earn Points, Get Free Expedited Shipping, and more! Learn More.

Seems like they are just using an overly specific lexagon based class to me.

Though it does seem plausible that they might then select on class^="gae-click" or class~="*Promos*"

JonSG
  • 10,542
  • 2
  • 25
  • 36
1

The * sign is a valid value for class attributes, the usage in Zappos.com's website is probably related to the framework they are using (maybe split by * to bind some events, like click or something).

While checking the CSS there is no definitions related to the classes with the * chars.

Using a class-with-very-long-definition-regarding-some-element can help during development in case you need to relations between elements. This is exactly the same as adding a data attribute if you don't really use it.

A nice use-case is to filter by "keywords" inside the class-names to add events (such as click/hover, using class*="click", for example).

Dekel
  • 60,707
  • 10
  • 101
  • 129