Jump to content

css class problem


Liquid Fire

Recommended Posts

here is my html and css code:
html:
[code]
<table>
<form id="login_form" method="post" action="login.php">
<tr><td align="right">User Name:</td><td><input class="light" type="light" name="user_name" /></td></tr>
<tr><td align="right">Password:</td><td><input class="light" type="light" name="password" /></td></tr>
<tr><td colspan="2" align="center"><input type="submit" name="submit" value="Login" /></td></tr>
</form>
</table>
[/code]

css
[code]
#login_form .light
{
background-color: #CCCCCC;
}
[/code]

Now my css is not the greatest but should this make the input box background color be light grey?  if i have this as my css code it works fine:
[code]
.light
{
background-color: #CCCCCC;
}
[/code]
the code works fine but i might not want all things with class="light" to have the background.  what is wrong with the first CSS code?
Link to comment
Share on other sites

The form should be wrapped around the table. Not the table wrapped around the form.

Your HTML is the error. It should be like this:
[code]<form id="login_form" method="post" action="login.php">
  <table>
    <tr><td align="right">User Name:</td><td><input class="light" type="text" name="user_name" /></td></tr>
<tr><td align="right">Password:</td><td><input class="light" type="password" name="password" /></td></tr>
<tr><td colspan="2" align="center"><input type="submit" name="submit" value="Login" /></td></tr>
  </table>
</form>[/code]
Also you was using an invalid input type of light. So I change the input fields to text and password for the username and password fields.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.