Hãy xem xét các lớp:Trình duyệt của tôi không phù hợp với CSS của tôi (nhưng jQuery làm)
.bio-target-measure {
opacity: 1;
}
.bio-target-measure:not(.lowerThird-25.lowerThird-active):not(.lowerThird-50.lowerThird-active):not(.lowerThird-100.lowerThird-active):not(.middleThird-25.middleThird-active):not(.middleThird-50.middleThird-active):not(.middleThird-100.middleThird-active):not(.upperThird-25.upperThird-active):not(.upperThird-50.upperThird-active):not(.upperThird-100.upperThird-active):not(.bud-25.bud-active):not(.bud-50.bud-active):not(.bud-100.bud-active) {
opacity: 0 !important;
}
<div class="mark bio-target-measure upperThird-100" title="Muestra
Plaga: Oidio
ID: [4]
Tercios: ["upperThird"]" style="width:100.0%;height:100%;color:white;background-color:#6a6200;">Test</div>
Và những cuộc gọi jQuery:
var measures = $('.bio-target-measure');
measures.length; // evaluates to 1.
measures.is('.bio-target-measure:not(.lowerThird-25.lowerThird-active):not(.lowerThird-50.lowerThird-active):not(.lowerThird-100.lowerThird-active):not(.middleThird-25.middleThird-active):not(.middleThird-50.middleThird-active):not(.middleThird-100.middleThird-active):not(.upperThird-25.upperThird-active):not(.upperThird-50.upperThird-active):not(.upperThird-100.upperThird-active):not(.bud-25.bud-active):not(.bud-50.bud-active):not(.bud-100.bud-active)');
// evaluates to true.
var emptyMeasures = $('.bio-target-measure:not(.lowerThird-25.lowerThird-active):not(.lowerThird-50.lowerThird-active):not(.lowerThird-100.lowerThird-active):not(.middleThird-25.middleThird-active):not(.middleThird-50.middleThird-active):not(.middleThird-100.middleThird-active):not(.upperThird-25.upperThird-active):not(.upperThird-50.upperThird-active):not(.upperThird-100.upperThird-active):not(.bud-25.bud-active):not(.bud-50.bud-active):not(.bud-100.bud-active)');
emptyMeasures.length; // evaluates to 1.
Nhưng opacity cho yếu tố như vậy, đáp ứng bộ chọn cho opacity: 0 !important;
(như nó đã được nhìn thấy bằng cách sử dụng jQuery), là 1. Google Ch của tôi trình duyệt rome (47.0.2526.106, Ubuntu 15.04, 64bits) chỉ sử dụng chỉ quy tắc đầu tiên (chỉ chỉ là để làm rõ: quy tắc với độ mờ 0 không phải là hiện tại nhưng được ghi đè: hoàn toàn vắng mặt trong trận đấu).
Câu hỏi: là: không quy tắc (như tôi đã sử dụng nó) một bộ chọn CSS hợp lệ? Tôi biết nó hoạt động trong jQuery, nhưng tôi hỏi về CSS.
Nó sẽ không được dễ dàng hơn rất nhiều để sử dụng một lớp khác nhau cho opacity, chứ không phải là không bao gồm tất cả những yếu tố với ': not' – adeneo
Theo như tôi biết, CSS ' : not' chỉ lấy các bộ chọn đơn giản làm đầu vào. Vì vậy, bản thân đầu tiên phải được viết dưới dạng '.bio-target-measure: not (.lowerThird-25): không (.lowerThird-active)'. – Harry
Loại trừ là vì tôi sử dụng các bộ chọn khác ở đó và thêm/xóa các lớp để làm cho độ mờ đục. Bây giờ tôi sẽ kiểm tra các bộ chọn –