Is it ok to allow: after pseudo element get focus on tab click
I have one h1 element that has: after the pseudo element, when first clicks on the tab, that h1 element will receive focus, but when I click on the tab again, the focus goes to the next REAL element, how can I make the focus go to the pseudo element?
HTML:
<h1 class="title" tabindex="0">Some text</h1>
CSS
title::after {
width: 16px;
height: 16px;
background: url('image')
}
I want to focus on this 16X16 image, is it possible?
+3
richie
source
to share
1 answer
Pseudo-elements ::before
and are ::after
not configurable.
If you absolutely need this focus checkbox, you will need to make it a real element, possibly inserted with JS, if you are not comfortable with messing up your markup.
+2
BoltClock
source
to share