锚标记焦点状态与浏览器默认大纲不一致

时间:2016-03-01 21:45:52

标签: css focus

所以我有一个问题,我试图用新样式替换焦点状态的轮廓选项。不幸的是,似乎css:focus属性与大纲的工作方式不同。

这是一个简单的例子: https://jsfiddle.net/mfeola/my8ngbow/

package times_Table;

import java.util.Scanner;

public class Times_Table {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        final int TOTAL = 5;

        System.out.print("Enter an integer between 1 and 12:");
        int input = sc.nextInt();
        int numbers = input;

        //If the input is out of the range 1-12 keep going
        //If the input is in the range of 1-12 stop

        //Need to find a way to keep looping if the integer inputed is     out of the range 1-12
        while (numbers>1 && numbers<12) {
            if (numbers<1 && numbers>12) {
                for (int i = 1; i <= TOTAL; i++) {
                    for (int j = 1; j<=TOTAL; j++) {
                        System.out.print(i*j + "\t");
                    }
                    System.out.println();
                }
            } else {
                if (numbers < 1 && numbers > 12) {
                    System.out.print("Enter an integer between 1 and 12:");
                }
            }
        }
    }
}

如果你点击第一个链接并按住,你会看到链接变为浏览器的默认颜色(我的是红色),但在第二个链接时,它是橙色的(来自css文件) 。如果在两个链接之间切换,则会显示轮廓,并且第一个链接上的颜色不会更改,但第二个链接会显示颜色。

如何在不使用javascript的情况下设置此样式,以便它们的行为相同,但仅在制表时,颜色会变为橙色?

enter image description here

这是它应该如何运作

enter image description here

2 个答案:

答案 0 :(得分:0)

喜欢这个? :)

.focus:focus {
    color:orange
}

工作jsfiddle

编辑:现在应按预期工作:)

答案 1 :(得分:0)

使用AttributeError: 'tuple' object has no attribute 'pyrr'

:active
body {
  font-family: Arial;
}
a:active {
  color: orange;
}

jsfiddle https://jsfiddle.net/my8ngbow/2/