As far as I know you can't really target tags by their elements. Since the submit button is just a type="submit" input tag, the normal input rules will apply to it. I'd say go with your second style and remember that some of the properties will cascade down.. you may have to redefine certain properties in the CSS for the submit button to look like you want it.


I'd also give the form an ID because that those declarations will bleed throughout your entire site. This may not be a problem, but it potentially could be in the future if you added more forms that needed different style. Besides, it's just good practice to keep everything orderly :) I.E., if it is a Search form, you'd use search#form input, and use <form id="search" ....> for your tag.

Besides, that way is perfectly acceptable and very clean structure-wise - what exactly were you "after"?

Ryan
------------------
"Heck with kids - standards are our future."
Webmaster, http://www.theward.net

Taco Fleur wrote:

Is there some way that you can only target input elements with type SUBMIT?

Example;

<style>
form input
{
        background-color: #FFCFCE;
        border: 1px solid black;
        font-weight: bold;
        color: white;
        width: 160px;
        background-image: url(../image/buttonSubmit_background03.gif);
        cursor: hand;
        background-repeat: repeat-x;
}
</style>
</head>

<body>

<form>
  <input type="submit" value="test"><br/>
  <input type="text" name="blah">
</form>

This would apply the style over all INPUT elements, but I was wondering if it could be just applied to the input elements that have type SUBMIT or BUTTON?

I realize I could do it the following way, but thats not what I am after.

<style>
form input .submit
{
        background-color: #FFCFCE;
        border: 1px solid black;
        font-weight: bold;
        color: white;
        width: 160px;
        background-image: url(../image/buttonSubmit_background03.gif);
        cursor: hand;
        background-repeat: repeat-x;
}
</style>
</head>

<body>

<form>
  <input type="submit" value="test" class="submit"><br/>
  <input type="text" name="blah">
</form>
*Taco Fleur
*Tell me and I will forget
Show me and I will remember
Teach me and I will learn

*****************************************************
The discussion list for http://webstandardsgroup.org/
*****************************************************




Reply via email to