| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 115913 | 2011-02-09 01:40:00 | HTML/CSS question | Tony (4941) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 1176574 | 2011-02-09 01:40:00 | I suspect I'm missing something obvious, but is the difference in effect between these two CSS blocks: li.myclass {somecss} and .myclass li {somecss] ??? |
Tony (4941) | ||
| 1176575 | 2011-02-09 01:52:00 | The first applies to <li class="myclass">, the second applies to <li> within another tag with that class (<ul class="myclass"><li>text</li></ul> for example) Hope I don't confuse you - I'm a lousy teacher :p |
pcuser42 (130) | ||
| 1176576 | 2011-02-09 02:44:00 | The first applies to <li class="myclass">, the second applies to <li> within another tag with that class (<ul class="myclass"><li>text</li></ul> for example) Hope I don't confuse you - I'm a lousy teacher :pOk, so what happens if I just "myclass" elsewhere - e.g. <p class=myclass">? Is this right?: .myclass {color:red;} li.myclass {color:blue} .myclass li {color:green} <p class="myclass">this text will be red</p> <ul> <li class="myclass">this text will be blue</li> </ul> <ul class="myclass"> <li>this text will be green</li> </ul> |
Tony (4941) | ||
| 1176577 | 2011-02-09 03:05:00 | Yes, that's correct. :) | pcuser42 (130) | ||
| 1176578 | 2011-02-09 03:16:00 | Yes, that's correct. :) Great, thanks for the help. :thumbs: The problems of not doing this stuff all the time - (a) you never really learn it properly and (b) you forget what you have learned. :) | Tony (4941) | ||
| 1 | |||||