CSS - style a link based on its “rel” attribute?

前端 未结 4 806
花落未央
花落未央 2020-12-02 20:25
 LINK 

is it possible to add css rules for rel=\"external\" ?

4条回答
  •  星月不相逢
    2020-12-02 21:21

    Felix Kling and thirtydot suggested to use the [att=val] attribute selector (a[rel="external"]). But this will only work if external is the only rel value.

    If you want to style links that could have 1 or more rel values, you should use the [att~=val] attribute selector:

    a[rel~="external"] (note the tilde character)

    An example for such a link could be:

    LINK
    

    See http://www.w3.org/TR/css3-selectors/#attribute-representation for the specification.

提交回复
热议问题