• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

input element css

In my css I've added a border to all input fields. This is fine for text input but if I want button input fields to retain their default styling is there anyway to do that after having set a border for all inputs?

I want to avoid having to add a class for text inputs, I just want to add a class for button inputs to reset their styling.
0
ncw
Asked:
ncw
2 Solutions
 
BadotzCommented:
Use the <button> tag instead of <input type="button">
0
 
ZadoCommented:
Try this in your css:

input:not(input[type=button]) {
 // your code here
}

Open in new window


it will affect all input fields except buttons.
0
 
ZadoCommented:
...you can play with attribute selectors, you can style for example only text fields and textarea:

input[type=text],
textarea  {
 // your code here
}

Open in new window


etc...
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
scrathcyboyCommented:
CSS is cascading -- so put --

INPUT.TEXT first with border, then
INPUT.IMG second with no border
0
 
ncwAuthor Commented:
I didn't realise you could use this syntax in css, seems to work. Thanks.
0
 
BadotzCommented:
No worries - glad to help.
0
 
ZadoCommented:
No problem, thanks for points :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now