Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS how to target 2 attributes?

OK if I want to target an <input> tag with type="submit" I can do so like:

input[type=submit] 

Also if I want to target an <input> tag with value="Delete" I can do so like:

input[value=Delete] 

But How can I target an <input> tag with BOTH?

like image 827
JD Isaacks Avatar asked Aug 03 '10 13:08

JD Isaacks


People also ask

How do I target a second sibling in CSS?

You use the general sibling selector (~) in combination with :hover . The ~ combinator separates two selectors and matches the second element only if it is preceded by the first, and both share a common parent.


2 Answers

input[type=submit][value=Delete] 

You're chaining selectors. Each step narrows your search results:

input 

finds all inputs.

input[type=submit] 

narrows it to submits, while

input[type=submit][value=Delete] 

narrows it to what you need.

like image 165
MvanGeest Avatar answered Oct 11 '22 20:10

MvanGeest


You can use multiple attributes as follows:

input[type=submit][value=Delete] {     /* some rules */ } 
like image 43
Pat Avatar answered Oct 11 '22 20:10

Pat