Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apply Style only to input=text

Tags:

html

css

I have CSS code like this

div ul li input{ width:70%}

What to do if I want this style applicable Only to the input elements of type=text ?

like image 966
TriNitroToluene Avatar asked Nov 09 '11 16:11

TriNitroToluene


People also ask

How do you input CSS in HTML?

CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements. Internal - by using a <style> element in the <head> section. External - by using a <link> element to link to an external CSS file.

How do you color a input box in HTML?

Definition and Usage. The <input type="color"> defines a color picker. The default value is #000000 (black). The value must be in seven-character hexadecimal notation.


2 Answers

Use an attribute selector

div ul li input[type=text] { width: 70%; }
like image 62
BoltClock Avatar answered Nov 13 '22 05:11

BoltClock


div ul li input[type=text]
{ 
    width:70%
}
like image 28
arb Avatar answered Nov 13 '22 07:11

arb