input type text CSS selector does not apply to default-type text inputs

0 votes

Text is the default input type. Therefore, I have always thought that input[type='text'] would be affected by CSS declarations even if the type was not explicitly defined on the control. But I've recently realised that the styles are not applied to my default-type text inputs. How come this is the case? And how do I deal with this?

input[type='text'] {
  background: red;
}
<input name='t1' type='text' /> /* Is Red */
<input name='t1' /> /* Is Not Red */
Aug 12, 2022 in CSS by Edureka
• 13,620 points
528 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In CSS

0 votes
1 answer

How to insert spaces/tabs in text using HTML/CSS

For spaces, use &nbsp;, for (less than, ...READ MORE

answered Jun 1, 2022 in CSS by Edureka
• 12,690 points
616 views
0 votes
1 answer

How to combine input:after:focus pure css?

One method is to create an element ...READ MORE

answered Jun 1, 2022 in CSS by Edureka
• 12,690 points
1,320 views
0 votes
1 answer

CSS text-overflow: ellipsis; not working?

So, if you've arrived at this question ...READ MORE

answered Jun 10, 2022 in CSS by Edureka
• 12,690 points
4,657 views
0 votes
1 answer

How to create material design input form using css and bootstrap?

Try with this code. HTML: <div class="main_div"> ...READ MORE

answered Jun 21, 2022 in CSS by Edureka
• 12,690 points
2,486 views
0 votes
1 answer

asp.net master page css not applying to asp form pages

just try the following code: <head> ...READ MORE

answered Jun 13, 2022 in CSS by Edureka
• 12,690 points
2,461 views
0 votes
1 answer

CSS to make HTML page footer stay at bottom of the page with a minimum height, but not overlap the page

A simple solution is to make the ...READ MORE

answered Jun 21, 2022 in CSS by Edureka
• 12,690 points
4,258 views
0 votes
1 answer

wildcard * in CSS for classes

Yes you can do this. *[id^='term-']{ ...READ MORE

answered Jun 21, 2022 in CSS by Edureka
• 12,690 points
637 views
0 votes
1 answer

jQuery vs document.querySelectorAll

As seen above, querySelector() methodcan only be used ...READ MORE

answered Jun 14, 2022 in JQuery by gaurav
• 23,260 points
4,587 views
0 votes
1 answer

input[type='text'] CSS selector does not apply to default-type text inputs?

Because that is not what it is ...READ MORE

answered Jun 28, 2022 in CSS by Edureka
• 12,690 points
1,606 views
0 votes
0 answers

Combinators in CSS

everyone! I am quite new to HTML ...READ MORE

Jul 8, 2022 in CSS by Edureka
• 13,620 points
347 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP