bold text when clicked and unbold when other item is clicked

how to make the text bold after i clicked and not bold if i clicked the other item?
14 Replies
Wonderbear
Wonderbear9mo ago
With the :focus selector and the font-weight property.
Justine
JustineOP9mo ago
can be but i want it when i clicked the other item it will be back to normal and the other item will now become bold
Wonderbear
Wonderbear9mo ago
Then apply the same rules to that item
Justine
JustineOP9mo ago
but then it all will be bold?
Wonderbear
Wonderbear9mo ago
Only the currently focused item will be bold
Justine
JustineOP9mo ago
here is my html <div class="job-button"> <a class="job-headline first-headline" data-action="click->jobs#filterByJobType" data-job-type="Vollzeit">vollzeit</a> <a class="job-headline" data-action="click->jobs#filterByJobType" data-job-type="Teilzeit">teilzeit</a> <a class="job-headline" data-action="click->jobs#filterByJobType" data-job-type="Praktikum">praktikum</a> </div>
ἔρως
ἔρως9mo ago
i wouldnt do this. making text bold will cause the items to move around, which can cause situations where you put the mouse over an item and it flickers between :hover and not :hover use other methods, like an outline, which doesnt change the size of the element if you do this, you have to be extremely careful to avoid the flickering, and i dont have a good method of avoiding it
Justine
JustineOP9mo ago
how do you make the focus here ? defined in css? <div class="job-button"> <a class="job-headline first-headline" data-action="click->jobs#filterByJobType" data-job-type="Vollzeit">vollzeit</a> <a class="job-headline" data-action="click->jobs#filterByJobType" data-job-type="Teilzeit">teilzeit</a> <a class="job-headline" data-action="click->jobs#filterByJobType" data-job-type="Praktikum">praktikum</a> </div> the focus is not applying to each button
ἔρως
ἔρως9mo ago
:focus will only style those when the <a> is focused you click ANYWHERE else, or press any key, and it will lose focus no focus, no :focus
Justine
JustineOP9mo ago
im done, thanks for the help
ἔρως
ἔρως9mo ago
i have a feeling that you are trying to make links work like radio buttons
Justine
JustineOP9mo ago
nope your advice for focus just work for me and thats waht im trying to achieve.thanks again
ἔρως
ἔρως9mo ago
you're welcome

Did you find this page helpful?