【问题标题】:How to disable a link using CSS? [duplicate]如何使用 CSS 禁用链接? [复制]
【发布时间】:2019-11-26 06:53:42
【问题描述】:

我在wordpress 页面中有以下链接。

这个类是一个链接。是否可以仅使用 CSS 禁用链接?

<a class="select-slot__serviceStaffOrLocationButton___5GUjl"><i class="material-icons select-slot__serviceStaffOrLocationIcon___3WFzp">timelapse</i><span class="select-slot__serviceName___14MHL">Employee Assistance Line</span></a>

【问题讨论】:

    标签: html css wordpress


    【解决方案1】:

    你可以这样做:

    .select-slot__serviceStaffOrLocationButton___5GUjl {
      pointer-events: none;
      color: black; (the color which is your normal text maybe?)
    }
    

    【讨论】:

      【解决方案2】:

      使用pointer-event:none;

      .select-slot__serviceStaffOrLocationButton___5GUjl{
        pointer-event:none;
      }
      &lt;a class="select-slot__serviceStaffOrLocationButton___5GUjl"&gt;&lt;i class="material-icons select-slot__serviceStaffOrLocationIcon___3WFzp"&gt;timelapse&lt;/i&gt;&lt;span class="select-slot__serviceName___14MHL"&gt;Employee Assistance Line&lt;/span&gt;&lt;/a&gt;

      【讨论】:

        【解决方案3】:
        .select-slot__serviceStaffOrLocationButton___5GUjl
        {
        pointer-events: none; 
        }
        

        将此添加到 css。

        如果您想将链接显示为普通文本,请使用此链接。

         .select-slot__serviceStaffOrLocationButton___5GUjl
        {
        pointer-events: none; 
        cursor: default; 
        text-decoration: none; 
        color: black; 
        }
        

        【讨论】:

          猜你喜欢
          • 2011-01-06
          • 2018-10-08
          • 2016-01-29
          • 1970-01-01
          • 2014-01-10
          • 1970-01-01
          • 1970-01-01
          • 2020-07-09
          相关资源
          最近更新 更多