它可能只能用于JavaScript,但我想知道是否可以通过以下事件将某个样式链接到另一个样式:focus或:仅在CSS中悬停。使用CSS定位除自身以外的样式
例如,类“hitArea”在焦点时是否可以更改“changeArea”背景属性?
.changeArea { background: yellow; }
.hitArea div:focus { changeArea:changeBG; }
.changeArea changeBG { background: blue; }
我知道这个工作的例子做CSS动画的时候,好像有风格之间的通信:
.reveal {
position:absolute;
top:190px;
left:0px;
margin-left:0px;
-webkit-animation-name:reveal;
-webkit-animation-duration:0.1s;
-webkit-animation-fill-mode:backwards;
-webkit-animation-delay:0.2s;
animation-name:reveal;
animation-duration:0.1s;
animation-fill-mode:backwards;
animation-delay:0.2s;
}
@-webkit-keyframes reveal {
0% { left:-900px; -webkit-animation-timing-function:linear; }
99% { left:-900px; -webkit-animation-timing-function:linear; }
100% { left:0px; }
}
那么什么是语法,或者是它甚至有可能,对我来说,彼此之间沟通风格?
你的HTML看起来像什么? – Bart 2013-04-04 20:00:23
如果你想要一个效果,添加一个类不会改变一个类。 – Vector 2013-04-04 20:01:58
在CSS3中,元素A的':hover'或':focus'只能用于更改元素B上的样式,如果B是A的后代,或者B是出现在A之后的A的同胞。 – 2013-04-04 20:04:24