<style>.f-1, .f-1 a {
color: #fff;
}
.f-2, .f-2 a {
color: #000;
}</style>
<body class="f-2">
<ul class="f-1">
<li><a>TEST COLOR</a></li>
</ul>
</body>
因为css中的f-2跟随f-1,所以浏览器呈现TEST COLOR白色(#fff)。我怎样才能使它呈现最接近的后代呢?
答案 0 :(得分:0)
我是Vivek的第二个建议。规则Sub checkcopy()
Const FLDR As String = "C:\Supplier\"
Const EXCLUDE_FILE As String = "SummaryCheckFile.xlsm"
Dim cf As String, c As Range, wb As Workbook
'set the first copy destination
Set c = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
cf = Dir(FLDR & "*.xls*", vbNormal) 'only Excel files
Do While Len(cf) > 0
Debug.Print cf
'opening this file ?
If UCase(cf) <> UCase(EXCLUDE_FILE) Then
Set wb = Workbooks.Open(FLDR & cf, ReadOnly:=True)
wb.Sheets(1).Range("A1:E1").Copy c 'assumes copying from the first sheet
Set c = c.Offset(1, 0) 'next destination row
wb.Close False
End If
cf = Dir 'next file
Loop
End Sub
和.f-2 a
都具有相同的specificity。因此,您必须使.f-1 a
更具体的规则适用。您可以尝试TEST COLOR
或.f-1 > a
。
答案 1 :(得分:0)
您可以使用inherit
功能。这可以继承父母的财产。
span {
color: blue;
border: 1px solid black;
}
.extra span {
color: inherit;
}
<div>
Here is <span>a span element</span> which is blue, as span elements are set to be.
</div>
<div class="extra" style="color:green">
Here is <span>a span element</span> which is green, because it inherits from its parent.
</div>
<div style="color:red">
Here is <span>a span element</span> which is blue, as span elements are set to be.
</div>