PDA

View Full Version : CSS forms issue


Jittor
11-10-2009, 02:02 PM
Hello all,

So I am using CSS to style a form and I noticed that the CSS that I am using effects both my text boxes and my check boxes, really all the boxes. For example, the CSS has the text boxes at 150px width, this also gives my check boxes a 150ox width. It very annoying because it places the actual check box in the center of that 150px. The CSS is for the "input" on the form which covers basically every on the form so I am pretty sure that is the issue. Is there a way around this, or CSS to style each option separately (text box, drop down, check box, etc...)?

Here is the CSS for that section:


}
input {
font-size: 12px;
color: #000000;
background: #e4e6dc;
height: 15px;
width: 150px;
border: 1px solid #000066;
}

I know I can do this with spry, but would like to know if there is a better way with CSS. Don't want my CSS to be lacking or sloppy. :)

gentleone
11-10-2009, 02:24 PM
It's because you style 'input' and a checkbox is also an input type.

Give them an ID or class, like:
<input type="text" size="25" value="" id="textbox">
<input type="checkbox" name="option1" value="whatever" id="checkbox">

And now you can style them separate.

CSS:
#textbox {bla,bla}
#checkbox {bla,bla}

domedia
11-10-2009, 02:25 PM
A CSS rule for he INPUT element is of course going to affect all INPUT elements. No surprise there.
Can't you just add a class?
Example:
<input type="text" class="text">
<input type="checkbox" class="checkbox">

Jittor
11-10-2009, 03:34 PM
Duh....I knew that! It's been one of those days and my brain has just stopped working.....and it's only 11:33!!!

Thanks Guys!

domedia
11-10-2009, 04:18 PM
Duh....I knew that! It's been one of those days and my brain has just stopped working.....and it's only 11:33!!! I always blame lack of coffee ;)

edbr
11-10-2009, 11:36 PM
or too much blood in the alcohol stream

Avazoks09
11-22-2009, 10:03 AM
Each page is going to need its own coding anyway; it wont be hard to change the color coding in the CSS on each page. Or am I misunderstanding the "3 pages" concept?

gentleone
11-22-2009, 10:15 AM
Each page is going to need its own coding anyway

It's recommended to use an external stylesheet for your whole website. The structure for every page is the same, so better to use an external stylesheet.
If you use a style that only applies to an element on 1 page, then you'll add this on the page itself.

edbr
11-23-2009, 12:16 AM
i suspect the post by Avazoks09 (http://www.dreamweaverclub.com/forum/member.php?u=28211) is a spam robot what 3 pages, allowing a denial here to be sure, if not it will probably be deleted

gentleone
11-23-2009, 10:38 AM
Ohkay... A well... I like to communicate with robots once in a while :)