faqts : Computers : Internet : Web : CSS : Styling FORM Elements

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

4 of 7 people (57%) answered Yes
Recently 4 of 7 people (57%) answered Yes

Entry

is it possible to declare a style for INPUT elements but a different one for checkboxes?

Mar 8th, 2004 17:21
Piers Johnson, Jenö Groller, jsWalter,


Sure, just give the checkbox or radio button a different class.
I use:
input, select, textarea { border:1px solid #c5d0ae; }
.submit { 
	background-color:#786;
	border:1px solid #ab9;
	color:#fff;
	margin:4px;
	text-align:center;
	font-weight:bold;
}
.noborder  { border:0px; }
Standard inputs I want to have a border on, just use as normal:
<input type="text" name="foo" value="bar" />
Checkboxes and radio buttons I want unadorned, so I use:
<input type="checkbox" class="noborder" name="menu" value="1" /> 1
etc...