【原创】css父类hover 子类感应出效果

.father{ width:200px; height:200px; border:1px solid #06C;}
 .children{ margin:50px auto; width:100px; height:100px; background:#33C; transition:border-radius 0.4s;}
 
 .father:hover .children{ border-radius: 50px;}
父类hover,子类感应出效果
<div class="father">
  <div class="children"></div>
</div>

应用场景:

css的操做,不少都是针对当前元素的直接操做。而此例子,是父类做为hover对象,而后子类出效果。
(例子中用到了css3的过渡transition属性。)css

一点思考:
css的获取对象操做的选择器,不像jquery那么方便,可是css3已经作了很大改进,之后css3我预计会继续向jquery的选择器靠拢。html

相关文章
相关标签/搜索