Setting width with CSS attr()

后端 未结 3 1510
萌比男神i
萌比男神i 2020-12-06 03:44

I\'m trying to set the width of an element using attr() in CSS but it\'s not working. Chrome says \"invalid property value\" but I\'m not sure what\'s wrong.

I\'m tr

3条回答
  •  日久生厌
    2020-12-06 04:33

    This is an experimental, or at least draft, feature of CSS, and currently, according to Mozilla Developer Network's documentation, is only compatible with the CSS content property (in which it can return a string to be placed inside a pseudo-element), but cannot (yet) be used to generate values for other properties.

    References:

    • attr() (at MDN).
    • attr() (at W3C).

提交回复
热议问题