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 8594193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:08:41+00:00 2026-06-12T00:08:41+00:00

I have created a CSS class called ‘button’ and applied it to all of

  • 0

I have created a CSS class called ‘button’ and applied it to all of my INPUT tags by simply using :

.button input
{
//css stuff here
}

<p class="button">
<input type="submit" Name='submit' value="Confirm Selection"/>
</p>

which works fine, but I then added another button, but this isn’t part of my form, it is just a place holder which is trigerred with javascript, and opens an iFrame. As I wanted it to look the same as all the ‘real’ buttons I used the same class.

<p class="button" id="AddCustomer">
<a href="AddCustomer.php">Add Customer</a>
</p>

The Problem I had was that if I left the class as .button input the <a> tag didn’t see it. If I removed the input part of the CSS all my buttons got grey squares in the middle.

So I resolved it with .button input,a

This worked fine. . . Until I looked at another page, and found all of my <a> tags were now formatted with the ‘button’ class, even though they don’t have this class applied.

My question then is how can I apply the same CSS class to <input> and <a> tags at the same time, but only if I have explicitly added class="button".

  • 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. Editorial Team
    Editorial Team
    2026-06-12T00:08:42+00:00Added an answer on June 12, 2026 at 12:08 am

    You need to qualify the a part of the selector too:

    .button input, .button a {
        //css stuff here
    }
    

    Basically, when you use the comma to create a group of selectors, each individual selector is completely independent. There is no relationship between them.

    Your original selector therefore matched “all elements of type ‘input’ that are descendants of an element with the class name ‘button’, and all elements of type ‘a'”.

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

Sidebar

Related Questions

I have created a button CSS class that uses background images with different positions
I have template in which a button is created with a link using css,
If you are using jQuery and have a CSS class called .draggable_rectangle , how
I have created tab style interface using css and javascript with only two tabs
I'm using Drupal 6 and have created 2 equal columns in layout.css In the
I have this AJAX loader, created using CSS. And I m trying to increase
I have a css class: input { font-family: Arial, Helvetica, sans-serif; font-size: 10px; border:
I have created a class using an object as well as using Jquery 1.7.2.
I want for all images on my webpage to have CSS class fadeIn so
I have created a CSS class as follows: div.ycontent div.ppclisting { background-color:#cccccc; } div.ycontent

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.