zoukankan      html  css  js  c++  java
  • What does a CSS selector in square brackets select in HTML?

    What does a CSS selector in square brackets select in HTML?

    So I have seen this CSS rule-set in a library:

    [text-uppercase] {
       text-transform: uppercase;
    }
    

    and I am not sure on how to use it in a div

    <div class="text-uppercase | [text-uppercase]"></div>
    

    I have tried both, but neither are working. I am seeing this in ionic2.

    回答1

    For the selector to work:
    <div text-uppercase></div>

    [text-uppercase] selector matches an attribute on a tag.

    回答2

    It's not a class, you encountered a so called attribute selector. It matches every html element that has got that attribute set, whatever the value. I.e. <section text-uppercase="true">, <div text-uppercase="something">, <nav text-uppercase>

    Look at the reference provided on the link above for more advanced usage scenarios.

    [text-uppercase] {
      text-transform: uppercase;
    }
    <span text-uppercase>hello</span>
  • 相关阅读:
    bzoj1027
    bzoj1069
    poj2079
    poj2187
    bzoj2281
    bzoj2285
    bzoj1558
    bzoj1822
    bzoj1559
    bzoj1570
  • 原文地址:https://www.cnblogs.com/chucklu/p/14234147.html
Copyright © 2011-2022 走看看