Forum Moderators: not2easy

Message Too Old, No Replies

CSS to Style a Forms Input Tags

Seems to work with everything except IE?

         

soquinn

9:23 pm on Jan 21, 2005 (gmt 0)

10+ Year Member



Hello, I'm trying to apply some style to all forms and buttons throughout a site with css. The below code seems to work with everything except IE? Can anyone verify this or have alternatives?

input[type="text"] {

font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
}

input[type="file"] {

font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
}

input[type="submit"] {

font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
color: #000000;
border-color: #CCCCCC #808080 #808080 #CCCCCC;
border-style: solid;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px
}

createErrorMsg

3:51 pm on Jan 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



IE does not support attribute selectors. To apply those specific styles to specific elements in IE, you'll have to assign them to a class name and add that class name to the relevant <input> elements in your source code.

css:
input.text {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
}

input.file {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
}

input.submit {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
color: #000000;
border-color: #CCCCCC #808080 #808080 #CCCCCC;
border-style: solid;
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px
}

html:
<input type="text" class="text />
<input type="file" class="file" />
<input type="submit" class="submit" />

cEM

soquinn

4:18 pm on Jan 22, 2005 (gmt 0)

10+ Year Member



Thanks createErrorMsg, I figured as much! The other way would be too easy :)