[关闭]
@sammffl 2016-03-02T01:48:42.000000Z 字数 455 阅读 620

css(attr\currentColor\user-select::selection)

小技巧


1、attr(key)

  1. <p data-unit="元">剩余话费40</p>
  1. [data-unit]:after{
  2. content: attr(data-unit);
  3. color: #3b98e0;
  4. }

2、currentColor

  1. <div class="box"> 测试测试 </div>
  1. .box{
  2. width: 200px;
  3. height: 200px;
  4. color: #3b98e0;
  5. border: 1px solid currentColor;
  6. }

3、user-select

  1. <div id="box-1">test</div>
  1. #box-1{
  2. -webkit-user-select: none;
  3. -moz-user-select: none;
  4. user-select: none;
  5. }

4、::selection

  1. <p id="sel">adfaksdfkalasdf</p>
  1. #sel::selection{
  2. background:#FE6E66;
  3. color:#FFF;
  4. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注