how to add borders for search and location icon when clicked inside search field?

https://codepen.io/avinash-tallapaneni/pen/ExRomwX. i tried using focus within still has no effect
8 Replies
Avinash
AvinashOP2y ago
i gave
.search-form input[type="text"]:focus + .search-icon button
{
border: 2px solid var(--btn-bg-secondary);
border-left: none;
}
.search-form input[type="text"]:focus + .search-icon button
{
border: 2px solid var(--btn-bg-secondary);
border-left: none;
}
onlu search icon border is highlighting, when i give the same to location icon is not showing anything
Mannix
Mannix2y ago
you could use :focus-within on the form element
Avinash
AvinashOP2y ago
i tried this one
.search-form:focus-within .location-btn,
.search-form:focus-within .search-btn {
border-color: var(--btn-bg-secondary);
}
.search-form:focus-within .location-btn,
.search-form:focus-within .search-btn {
border-color: var(--btn-bg-secondary);
}
but it has no effect so i used this
.search-form input[type='text']:focus+.location-icon button
{
border:2px solid var(--btn-bg-secondary);
border-right:none;
}


.search-form input[type='text']:focus+.search-icon button
{
border:2px solid var(--btn-bg-secondary);
border-left:none;
}
.search-form input[type='text']:focus+.location-icon button
{
border:2px solid var(--btn-bg-secondary);
border-right:none;
}


.search-form input[type='text']:focus+.search-icon button
{
border:2px solid var(--btn-bg-secondary);
border-left:none;
}
this one is working but only for search icon
Mannix
Mannix2y ago
.search-form:focus-within{border: 2px solid var(--btn-bg-secondary);} it will make a border around the all three elements
Avinash
AvinashOP2y ago
oh yeah i worked Thankyou so much
Avinash
AvinashOP2y ago
by any chance you know how to fix this?? gave same border radius. but when i highlight it seems the border radius is way too much
Avinash
AvinashOP2y ago
@mannix_
Mannix
Mannix2y ago
put the radius on the form not the buttons you might also need to add overflow:hidden on it
Want results from more Discord servers?
Add your server