嗨,我有一个应用了Css角色的通用DIV。
我想知道CSS是否允许在DIV中设置HTML标记的样式(仅适用于具有该角色的DIV),该标记具有Css角色。
请让我知道你的想法。 谢谢你的时间。
<div class="Role"> <table></table> </div> .Role { // Style for <table> tag. }Hi I have a generic DIV with a Css Role applied.
I would like to know if CSS allows to set the style for an HTML Tag inside a DIV (only for DIV with that Role) which has a Css Role.
Please let me know your thoughts. Thanks for your time on this.
<div class="Role"> <table></table> </div> .Role { // Style for <table> tag. }最满意答案
你有几个选择:
例如, 后代选择器选择器.Role table选择用于应用包含在元素中的所有表,无论如何,使用类Role。
子选择器 .Role > table将关联的规则应用于具有类Role的元素的子(而不是后代)的表
例如,考虑这个html片段:
<div class="Role"> <table id="t1"> <tr><td> <table id="t2"> .... </table> </td></tr> </table> </div> .Role表将css规则应用于表#t1 和表#t2 .Role> table将css规则仅应用于表#t1 .Role> table table将规则应用于表#t2 跳转到表#t1You have several options to go:
The descendant selector selector .Role table, for example, select for apply all the table that are contained into an element, whatever, with class Role.
The child selector .Role > table will apply the associated rules to the tables that are child (not descendant) of the element with class Role
For example, consider this html fragment:
<div class="Role"> <table id="t1"> <tr><td> <table id="t2"> .... </table> </td></tr> </table> </div> .Role table will apply the css rule to table#t1 and table#t2 .Role > table will apply the css rule to table#t1 only .Role > table table will apply the rule to table#t2 skipping to table#t1更多推荐
发布评论