Jump to content

Why doesn't this css work


rv20

Recommended Posts

I have a form with some input text fields all within two divs wth class names "main" and "main_reg" both divs and the input field use inline css(i don't even know if you should apply inline css to a input text field?? maybe thats where the problem is??)

 

So if i do this,

 

input{background-color:#0C6;}

  then it changes the bgc of the input as this css sets ALL inputs to whatever css you give it but if i do,

 

#main_reg input{background-color:#0C6;}

  then it has no effect , i thought this was the right syntax??

 

<div style=
    "border:solid;width:1000px;height:500px; background-color:#fff"
    class="main">
  <div style ="margin:0 auto;width:600px;height:400px;" class = "main_reg">

  <form>
      Username:
      <input type="text" id="reg_user" name="reg_user" size="30px"
            style="font-size: 100%;margin-left:37px;" />
</form>
</div>
</div>

Link to comment
Share on other sites

#main_reg input{background-color:#0C6;}

 

will affect the element with the id "main_reg" as you have used the #,

 

for a class

 

<div style ="margin:0 auto;width:600px;height:400px;" class = "main_reg">

 

it should be

 

.main_reg input{background-color:#0C6;}

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.