WCAG: Firefox and Edge don't show outline on focussed input elements when styles are applied

前端 未结 4 894
广开言路
广开言路 2021-02-19 11:06

I\'m creating a form, that is following some WCAG guidelines. One of those is:

G165: Using the default focus indicator for the platform so that high visibility default f

4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-19 11:24

    The CSS outline property does exist and you can use it like this:

    .b {
      border: 1px solid red;
      -moz-appearance: none;
      -webkit-appearance: none;
    }
    
    input:focus {
      outline: 2px solid #2772DB;
    }
    
    

    If its not working or showing up, that may mean there is another style overlapping it so you can override it by adding !important

提交回复
热议问题