HighDots Forums  

Specifying style for all inputs of type text?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Specifying style for all inputs of type text? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
David Stone
 
Posts: n/a

Default Specifying style for all inputs of type text? - 05-13-2009 , 12:54 PM






Is there a way to set default styling on an input of a particular
type, much the same way as you might specify a style rule for all
p, div, td, h1, etc.? In other words, is there a way to specify
this in css without having to explicitly set a class in the html?

I'd like to specify a style rule that would only apply to (for
example) all inputs of type "radio", and another that would only
apply to all inputs of type "text", but I don't want to class
every instance of these inputs in a page.

Thanks.

Reply With Quote
  #2  
Old   
Jeff
 
Posts: n/a

Default Re: Specifying style for all inputs of type text? - 05-13-2009 , 02:21 PM






David Stone wrote:
Quote:
Is there a way to set default styling on an input of a particular
type, much the same way as you might specify a style rule for all
p, div, td, h1, etc.? In other words, is there a way to specify
this in css without having to explicitly set a class in the html?

Look up the attribute selector.

Not that this will fail in IE6 unless you run a javascript patch:

http://dean.edwards.name/weblog/2008/01/ie7-2/

see my note on this on 5/6 in this group.

I suspect that many in this group won't like that idea as it involves
javascript. Myself, I'm ready to move on from IE6 and don't particularly
care that this "fix" will fail in the 5% with javascript turned off in a
browser with an 18% falling market share and falling fast (ie, 1%). My
take is to prevent a catastrophic failure and ignore readable failures
in very small market shares. Note that browser stats vary widely.

You'll have to make your own call on that.

Jeff

Quote:
I'd like to specify a style rule that would only apply to (for
example) all inputs of type "radio", and another that would only
apply to all inputs of type "text", but I don't want to class
every instance of these inputs in a page.

Thanks.

Reply With Quote
  #3  
Old   
Gordon
 
Posts: n/a

Default Re: Specifying style for all inputs of type text? - 05-14-2009 , 04:24 AM



On May 13, 5:54*pm, David Stone <no.em... (AT) domain (DOT) invalid> wrote:
Quote:
Is there a way to set default styling on an input of a particular
type, much the same way as you might specify a style rule for all
p, div, td, h1, etc.? *In other words, is there a way to specify
this in css without having to explicitly set a class in the html?

I'd like to specify a style rule that would only apply to (for
example) all inputs of type "radio", and another that would only
apply to all inputs of type "text", but I don't want to class
every instance of these inputs in a page.

Thanks.
If needing to work in ie6 is not an issue then you can use input
[type="text"] as your CSS selector.


Reply With Quote
  #4  
Old   
David Stone
 
Posts: n/a

Default Re: Specifying style for all inputs of type text? - 05-14-2009 , 08:15 AM



In article
<0ec44a07-41f7-4143-bbc9-63b8c278b8cc (AT) u10g2000vbd (DOT) googlegroups.com>,
Gordon <grj.mcvey (AT) googlemail (DOT) com> wrote:

Quote:
On May 13, 5:54*pm, David Stone <no.em... (AT) domain (DOT) invalid> wrote:
Is there a way to set default styling on an input of a particular
type, much the same way as you might specify a style rule for all
p, div, td, h1, etc.? *In other words, is there a way to specify
this in css without having to explicitly set a class in the html?

I'd like to specify a style rule that would only apply to (for
example) all inputs of type "radio", and another that would only
apply to all inputs of type "text", but I don't want to class
every instance of these inputs in a page.

Thanks.

If needing to work in ie6 is not an issue then you can use input
[type="text"] as your CSS selector.
Thanks. I suspect there will still be a noticeable number of IE 6
users in the user pool, but the style rule is more cosmetic than
anything, so the site should still be fully functional. I'll have
to track down a machine to test this on, though!


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.