Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 128729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:40:55+00:00 2026-05-11T05:40:55+00:00

Is there any way with CSS to target all inputs based on their type?

  • 0

Is there any way with CSS to target all inputs based on their type? I have a disabled class I use on various disabled form elements, and I’m setting the background color for text boxes, but I don’t want my checkboxes to get that color.

I know I can do this with seperate classes but I’d rather use CSS if possible. I’m sure, I can set this in javascript but again looking for CSS.

I’m targeting IE7+. So i don’t think I can use CSS3.

Edit

With CSS3 I would be able to do something like?

INPUT[type='text']:disabled that would be even better get rid of my class altogether…

Edit

Ok thanks for the help! So here’s a selector which modifies all textboxes and areas which have been disabled without requiring setting any classes, when I started this question I never thought this was possible…

INPUT[disabled][type='text'], TEXTAREA[disabled] {        background-color: Silver; } 

This works in IE7

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:40:55+00:00Added an answer on May 11, 2026 at 5:40 am

    Yes. IE7+ supports attribute selectors:

    input[type=radio] input[type^=ra] input[type*=d] input[type$=io] 

    Element input with attribute type which contains a value that is equal to, begins with, contains or ends with a certain value.

    Other safe (IE7+) selectors are:

    • Parent > child that has: p > span { font-weight: bold; }
    • Preceded by ~ element which is: span ~ span { color: blue; }

    Which for <p><span/><span/></p> would effectively give you:

    <p>     <span style='font-weight: bold;'>     <span style='font-weight: bold; color: blue;'> </p> 

    Further reading: Browser CSS compatibility on quirksmode.com

    I’m surprised that everyone else thinks it can’t be done. CSS attribute selectors have been here for some time already. I guess it’s time we clean up our .css files.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way of pulling in a CSS stylesheet into FireFox 2 or
Is there any syntactical way in jQuery to define multiple CSS attributes without stringing
Is there any way to have something that looks just like a file on
Is there any way to use inheritance in database (Specifically in SQL Server 2005)?
Is there any way to force a listview control to treat all clicks as
Is there any way only using CSS (no script) to check if an element
Is there any way in CSS to put a limit on how far something
Is there any way to check whether a file is locked without using a
Is there any way to capture the MouseDown even from the .NET 2.0 TextBox
Is there any way to apply an attribute to a model file in ASP.NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.