How to css target “Tab” state of the input?


Tags: css,css3,accessibility,uiaccessibility

Problem :

I believe for accessibility cases, tab is used to navigate through different elements on the page, usually there is a dotted element around Tabbed element to indicate that it is in focus, I tried researching this, but didn't found a reference to a css rule that targets this state.



Solution :

The css selector you want is :focus, like input:focus { ... } but not everything can be tabbed to like this. Things like anchors, inputs and buttons can be tabbed to in this way. I do not know any more off the top of my head but things like div, span, h1/2/3/4/5/6 cannot be tabbed to.

Also to note, tabbing into an item is not the only way to bring it to focus. An anchor for example, you can hold left mouse button down over it and then move the cursor away before letting go. The item will be focused by doing this (it might aid your dev time if you want to style something near the end of the page.)


    CSS Howto..

    How do I align an icon right next to “Click here”?

    How insert value from Ruby in CSS file

    How can I find which file or code affected to my code in html, css

    How to make text disappear when HTML5 Video has finished loading?

    How can I add CSS and JS in Symfony2?

    How could i center unordered lists in a footer?

    css: how to vertically align table within div

    How can I eliminate phantom margins in my dropdown menu?

    Linking CSS button to email - How can it be done?

    How to make hover css menu fade in and out?

    How to apply CSS to part of some text without breaking the text content itself

    How to top align two cell divs within a table div when one cell div contains an absolute positioned div?

    Parsing erb within erb in a view. How to add CSS class?

    How to set a timer for CSS animation-timing-function?

    UI Challenge - how to draw “connectors” between elements?

    How to style using d3's .style() method instead of using CSS in style tags for .axis path {}?

    How to use Image instead of border-right with CSS in Wordpress?

    How to force dropdown boostrap buttons in a nav bar to fill the entire container width?

    how to set width of piechart in dc.js through css

    How to make dropdown list unselectable?

    How to create a speech bubble in css?

    How to read CSS property of Psuedo class in javascript

    How to set HTML element's margin using percent of page height?

    How to display a css animation in the center of the screen

    How to get a button to fill the full width of the footer in Mobile View?

    How to align an element when it locates below some float elements?

    How do I vertically centre a div of variable height within a div of variable height?

    How to conditionally apply CSS classes in Ember?

    How to build those rectangular with picture and text css bootsrap? [closed]

    CSS: how to make scrollbar appear outside div's border?