Japp! Attribute selectors http://www.w3.org/TR/css3-selectors/#attribute-selectors
input[type="text"] {}
Stöds av de flesta webbläsare men inte IE tidigare än version7...
http://www.quirksmode.org/css/contents.html
5 svar · 565 visningar · startad av Danne V
Eftersom flera input-element i ett formulär påverkas i ett formulär om man bara stilsätter taggen "input" så använder jag klasser.
Men jag har alltid undrat (och letat efter svar men inte hittat) om man inte kan stilsätta själva taggen med hjälp av någon slags selektor?
Typ:
input:text field
Kan man det?
Japp! Attribute selectors http://www.w3.org/TR/css3-selectors/#attribute-selectors
input[type="text"] {}
Stöds av de flesta webbläsare men inte IE tidigare än version7...
http://www.quirksmode.org/css/contents.html
Ah, sepåfasen! Tack.
Följdfråga: Kan man t.ex. fixa med
input[type=textarea]
input[type=radio]
input[type=list]
osv också då?
Ah, sepåfasen! Tack.
Följdfråga: Kan man t.ex. fixa med
input[type=textarea]
input[type=radio]
input[type=list]osv också då?
ja Nate.A postade w3 dokumentation om det: http://www.w3.org/TR/css3-selectors/#attribute-selectors
Det med, men textarea har en egen tagg..
Du kan specificera vilket attribut som helst.
href, title, alt mm.. du kan t.o.m
[att^=val]
Represents an element with the att attribute whose value begins with the prefix "val". If "val" is the empty string then the selector does not represent anything.
[att$=val]
Represents an element with the att attribute whose value ends with the suffix "val". If "val" is the empty string then the selector does not represent anything.
[att*=val]
Represents an element with the att attribute whose value contains at least one instance of the substring "val". If "val" is the empty string then the selector does not represent anything.
från : http://www.w3.org/TR/css3-selectors/#attribute-selectors