Html 以多个元素为目标,每个元素都具有相同的类
所以我想基本上这样做Html 以多个元素为目标,每个元素都具有相同的类,html,css,Html,Css,所以我想基本上这样做 table.mobile, td.mobile, tr.mobile { some css } 有没有一种不用指定每个元素的类就可以做到这一点的方法 大概是 (table, td, tr).mobile { some css } 你可以用 .mobile { // put css that are common to all element with class called mobile } *.mobile{ 背景:#00496d; 颜色:#ff
table.mobile, td.mobile, tr.mobile {
some css
}
有没有一种不用指定每个元素的类就可以做到这一点的方法
大概是
(table, td, tr).mobile {
some css
}
你可以用
.mobile
{
// put css that are common to all element with class called mobile
}
*.mobile{
背景:#00496d;
颜色:#fff;
}
正文
正文
正文
正文
正文
正文
正文
正文
正文
还没有。CSS选择器级别4指定了它,但浏览器还不支持它
Firefox和Chrome目前支持实验性的前缀伪类:-moz any
和:-webkit any
,因此对于这些浏览器,您可以编写
:-moz-any(table,tr,td).mobile{
显示:内联块;
边框宽度:1px;
边框样式:实心;
填充:3件
}
:-webkitany(表,tr,td).mobile{
显示:内联块;
边框宽度:1px;
边框样式:实心;
填充:3件
}
表{边框颜色:蓝色;}
tr{边框颜色:绿色;}
td{边框颜色:红色;}
p{边框颜色:黑色;}
边界
无边界
您可以使用.mobile{some css}
为此,您可以将名称更改为更具体的名称,只需使用即可。myClassName@SuperUser如果我想重用类名?@A.Lau,然后使用一些父上下文,例如.myParentPage.myClassName或.myCustomerPage,该怎么办。myClassName@Esko我想我能做到,但是我仍然想知道css中是否有这样一个选项。区分b/w*.classname和.classname是什么?它们都是相同的,并且都很想知道它们将来会出现。我想实现这种标记的唯一真正方法是通过LESS/SASS
.mobile
{
// put css that are common to all element with class called mobile
}