代码之家  ›  专栏  ›  技术社区  ›  patrick

删除svg上的“全选”蓝色水滴单击

  •  0
  • patrick  · 技术社区  · 6 年前

    Android上的Firefox有两个蓝色下拉框来指示选定的文本,然后它提供了更多选项,如 Copy All 当我单击SVG并试图将其关闭时,就会出现这种行为。

    要测试自己,请在Android上使用Firefox,单击星星: https://jsfiddle.net/wbzex7c8/

    .starContainerHeight {
      height: 50px;
    }
    
    #centerStarDiv {
      border: solid 1px #ff0000;
      text-align: center;
      margin: 0px auto;
      border: 1px solid white;
      height: 25px;
    }
    
    #centerStarDiv>div {
      display: inline-block;
      text-decoration-color: white;
    }
    
    .marginTop0px {
      margin-top: 0px !important;
    }
    
    .rating {
      float: left;
      border: 0px;
      text-align: center;
    }
    
    .rating>input {
      display: none;
    }
    
    .rating>span {
      float: right;
      width: 50px;
    }
    
    .rating>span>.star1 {
      color: transparent;
    }
    
    .rating>span>.star2 {
      color: white;
    }
    
    .rating input:checked~span>.star1 {
      color: #FFED85;
    }
    
    .rating input:checked~span>.star2 {
      color: #FFED85;
    }
    
    .rating:not(:checked)>span:hover>.star1 {
      color: yellow;
    }
    
    .rating:not(:checked)>span:hover>.star2 {
      color: #FFED85;
    }
    
    .rating:not(:checked)>span:hover~span {
      color: #FFED85;
    }
    
    .rating:not(:checked)>span:hover~span>.star1 {
      color: #FFED85;
    }
    
    .rating:not(:checked)>span:hover~span>.star2 {
      color: #FFED85;
    }
    

    HTML

    <div class="rating starContainer">
    <input id="star1" name="rating" type="radio" value="1">
    <span class="fa-layers fa-fw" style="margin-top:17px" id="span1" starnumber="5"><svg class="svg-inline--fa fa-star fa-w-18 star1 fa-3x" aria-hidden="true" data-prefix="fa" data-icon="star" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" starnumber="5">
    
    <path fill="currentColor" starnumber="5" d="M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"></path></svg><svg class="svg-inline--fa fa-star fa-w-18 star2 fa-3x" aria-hidden="true" data-prefix="far" data-icon="star" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" starnumber="5"><path fill="currentColor" starnumber="5" d="M528.1 171.5L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6zM388.6 312.3l23.7 138.4L288 385.4l-124.3 65.3 23.7-138.4-100.6-98 139-20.2 62.2-126 62.2 126 139 20.2-100.6 98z"></path></svg></span>
    </path>
    </svg>
    </span>
    </div>
    
    1 回复  |  直到 6 年前
        1
  •  3
  •   Gann14    6 年前

    为svg添加css属性,如下所示:

    svg { -moz-user-select: none; }
    

    这将解决您的问题。这对我有用。