Reputation: 65
I already know how to get rid of text input outlines with
input:focus {
outline:none;
}
but it doesn't work with textareas and selects. Thanks
EDIT: Already tried textarea:focus and select:focus, which don't work.
Upvotes: 1
Views: 95
Reputation: 2771
The :focus
isn't required. Try this:
HTML:
<textarea placeholder="without class"></textarea>
CSS:
textarea {
outline: none;
}
But if you can set a class, much better.
HTML:
<textarea class="no-focus" placeholder="Look ma, no focus!"></textarea>
<select class="no-focus">
<option value="">Option, no focus!</option>
<option value="">Option, no focus!</option>
<option value="">Option, no focus!</option>
</select>
<textarea class="focus" placeholder="Your amazing textarea with focus"></textarea>
<select class="focus">
<option value="">Option, with focus</option>
<option value="">Option, with focus</option>
<option value="">Option, with focus</option>
</select>
CSS:
.no-focus {
outline: none;
}
.focus {
outline-color: yellow;
}
/* Just for demo */
textarea {
width: 100%;
height: 100px;
}
select {
padding: 20px 0px;
width: 100%;
margin-bottom: 30px;
}
Upvotes: 0
Reputation: 677
no need for :focus
you can simply do that by
input[type="text"], textarea, select {outline:none}
here is the working demo Link
Upvotes: 1