If you only want to style a specific input type, you can use attribute selectors: input[type=text] - will only select text fields. input[type=password] - will only select password fields. input[type=number] - will only select number fields.
To select elements with a specific class, write a period (.) character, followed by the name of the class. You can also specify that only specific HTML elements should be affected by a class. To do this, start with the element name, then write the period (.)
Simple selectors (select elements based on name, id, class) Combinator selectors (select elements based on a specific relationship between them) Pseudo-class selectors (select elements based on a certain state)
Class-selector: The class selector selects HTML elements with a specific class attribute. Output: 4. Universal-selector: The Universal selector (*) in CSS is used to select all the elements in a HTML document.
You want input.some-class[type="text"]
.some-class input
looks for input tags that are descendants of .some-class
.
input.some-class
does the reverse.
input[type="text"].some-class {
....
}
with no space between "input[type="text"]" and ".some-class" will work..
input[type="text"]-space in between is the problem-.some-class {}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With