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
https://forums.phpfreaks.com/topic/33217-css-class-problem/
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
https://forums.phpfreaks.com/topic/33217-css-class-problem/#findComment-155115
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.