Home > Article > Web Front-end > CSS hover changes the styles of child elements and other elements
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='a'>元素1 </div> <div id='c'>元素3 <div id='b'>元素2</div> </div> </html>
More css hover changes the style of child elements and other elements For related articles, please pay attention to the PHP Chinese website!