rv20 Posted June 2, 2009 Share Posted June 2, 2009 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 https://forums.phpfreaks.com/topic/160621-why-doesnt-this-css-work/ Share on other sites More sharing options...
Alt_F4 Posted June 2, 2009 Share Posted June 2, 2009 #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 https://forums.phpfreaks.com/topic/160621-why-doesnt-this-css-work/#findComment-847652 Share on other sites More sharing options...
rv20 Posted June 2, 2009 Author Share Posted June 2, 2009 Yeah just got it myself, thanks anyway.! Link to comment https://forums.phpfreaks.com/topic/160621-why-doesnt-this-css-work/#findComment-847664 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.