如何在css中禁用li中的点击和选择

时间:2018-04-25 06:50:43

标签: css

任何人都可以告诉如何禁用css中的li中的点击和选择

我试过了

public static void main(String[] args) {

    //declare variable for user input and call method to initialize it
    int x = getNumber();
    long fact;
    int n;
    //Output first line
    System.out.println("N\t approximate e^" + x);

    for (n = 5; n <= 100; n *= 2) {
        if (n == 10) {
            fact = myFact(x, n);
            System.out.println(n + "\t " + fact);
            n += 15;
       } else {
            fact = myFact(x, n);
            System.out.println(n + "\t " + fact);
        }
    }
}

但是指针即将到来并且能够选择文本以避免

谢谢

1 个答案:

答案 0 :(得分:1)

您需要将cursoruser-select属性指定为none

 .disabled {
    pointer-events:none; 
    opacity:0.6; 
    cursor:none; 
    -webkit-user-select: none;  /* Chrome all / Safari all */
    -moz-user-select: none;     /* Firefox all */
    -ms-user-select: none;      /* IE 10+ */
    user-select: none;
}

以下是对user-selecthttps://css-tricks.com/almanac/properties/u/user-select/

的更深入了解