同级CSS [英] CSS for same level
本文介绍了同级CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我在同一级别上有3个div(不是一个div).当不使用ID和类将鼠标悬停在另一个div上时,如何更改其颜色.我想要类似的东西:
If I have 3 divs at the same level ( not one in another ) . How can I change the color of the other div when hover one without using IDs and classes. I would like somthing like :
<div id="1" ></div>
<div></div>
<div></div>
和CSS:
#1 :hover < body > div
{
//Here I change the things
}
推荐答案
使用通用的同级组合器
#yourId:hover ~ div
{
color:red;
}
还要注意,Id必须以字母开头. W3 ID属性
Also note that Id's must begin with a letter. W3 ID Attribute
这篇关于同级CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文