Home > Web Front-end > CSS Tutorial > CSS hover changes the styles of child elements and other elements

CSS hover changes the styles of child elements and other elements

高洛峰
Release: 2017-03-01 15:11:38
Original
2552 people have browsed it

css hover changes the style of child elements and other elements

+ indicates the next level element, > indicates child elements

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
</head>

<style>
    #a {color : #FFFF00;}

    #a:hover + #c{color : #00FF00;}
    #a:hover + #c > #b{color : #0000FF;}
</style>
<div id=&#39;a&#39;>元素1

</div>
<div id=&#39;c&#39;>元素3
    <div id=&#39;b&#39;>元素2</div>
</div>


</html>
Copy after login

More css hover changes the style of child elements and other elements For related articles, please pay attention to the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template