newcoder1010 Posted September 1, 2015 Share Posted September 1, 2015 (edited) <div class="NumberOfPeople_R"> <label for="edit-submitted-eventinformation-number-of-people">Number of people </label> <input required="required" class="NumberOfPeople_C form-text form-number required" type="text" id="edit-submitted-eventinformation-number-of-people" name="submitted[EventInformation][number_of_people]" size="4" min="10" max="250" step="1"> <div class="description">10 to 250</div></div> Hello, I have the above html and I am trying make the text '10 to 250' red color for one div class description only. I tried this and did not work. .NumberOfPeople_R .description {color:red;} Thanks. Edited September 1, 2015 by newcoder1010 Link to comment Share on other sites More sharing options...
Ingolme Posted September 1, 2015 Share Posted September 1, 2015 That looks correct. Are there any other CSS rules with higher precedence interfering with the style? You can see what styles are being applied to an element in the developer tools by pressing F12 in most browsers. Link to comment Share on other sites More sharing options...
newcoder1010 Posted September 1, 2015 Author Share Posted September 1, 2015 .description {color:red;} If I just use above code, it works. Not the other one I mentioned before. I did press F12 and I am not able to understand the other CSS rules. Link to comment Share on other sites More sharing options...
Ingolme Posted September 1, 2015 Share Posted September 1, 2015 How can you not understand the other rules if you wrote the CSS? Link to comment Share on other sites More sharing options...
dauruk0512 Posted September 7, 2015 Share Posted September 7, 2015 <div class="NumberOfPeople_R"> <label for="edit-submitted-eventinformation-number-of-people">Number of people </label> <input required="required" class="NumberOfPeople_C form-text form-number required" type="text" id="edit-submitted-eventinformation-number-of-people" name="submitted[EventInformation][number_of_people]" size="4" min="10" max="250" step="1"> <div class="description"><p>10 to 250</p></div></div> and here is the css .description p {color:red;} the reason why .description {color:red;} this give you succes because you wrapper div with class description whatever inside div will be red Link to comment Share on other sites More sharing options...
dsonesuk Posted September 7, 2015 Share Posted September 7, 2015 I have a feeling because '.NumberOfPeople_R' is different colour to '.description' in post#1 that it has not been saved correctly as UTF encoded, as the css styling is correct and should work, unless it is being overriding somewhere, just thought i would mention this as it has happened before. Link to comment Share on other sites More sharing options...
punterf16 Posted September 14, 2015 Share Posted September 14, 2015 (edited) Learn all about selecting child elements and combining it with other element here [link removed by moderator] Edited September 14, 2015 by Ingolme Links to competing tutorial websites are not allowed by the forum guidelines Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now