Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
How can i apply a border to a div element when it is focused, using tailwind?

I have a rounded div containing a button (i wanted to create a rounded "add button") and i'd like to apply a different border color to this div when it is focused, but i can't get the hoped result using the :focus modifier. This is what i tried

<div:class="
['flex
rounded-full
border border-blue-100
h-12 w-12
justify-center
absolute
bottom-10
right-5
focus:border-red-500'
]">
    <button type="button" class="text-5xl">+</button>
</div>"

However the border does not change color

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The DIV is not focusable - you should apply the classes on the BUTTON itself:

<button class="text-5xl flex rounded-full border border-blue-100 h-12 w-12 justify-center items-center focus:border-red-500">+</button>
about 4 years ago · Juan Pablo Isaza Report

0

the div is not focusable so you have to apply the border to button or there is another way that

you do focus-within instead of focus on div

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!