0

Here's the link to css code I am curious about : https://codepen.io/charlesxiao/pen/NWjgQQm.

Do you know what does the following css code means?

.awesome[data-sizing="intrinsic"] {
  width: min-content;
}

What's this data-sizing attribute? I can't find it anywhere.

Thanks!

Han XIAO
  • 1,148
  • 9
  • 20

1 Answers1

0

Much like how your selectors can target classes (.class) and ids (#id), your CSS can also target attributes, including data-*. It's common practice for javascript to target data-* attributes rather than going through the rigmarole of adding/removing classes. There's some particulars choosing between the two.

width: min-content; simply sets the element to the smallest possible size — the word "awesome" is the largest element and that's used as the width.

franklylately
  • 1,112
  • 10
  • 12