"Front-end learning notes" about CSS changing the style of another block by one block

Source: Internet
Author: User

<body>
<DivID= "a"style= "background: #0F0; height:100px; width:100px;"><DivID= "C"style= "background: #FF0; height:50px; width:50px;"></Div></Div><DivID= "B"style= "background: #900; height:200px; width:200px;"></Div></Body>
#c { display:none;} #b {display:none;} #a: hover+ #b {    display:block;        } #a: hover #c {    display:block;}

c is a child element, and when you use a to control the style of C, #a: hover #c {}

b is a sibling element, use a to control the style of B, with +, for #a:hover+ #b {}

Need to change the style must be written in the CSS, if written in HTML, because the HTML priority, the changed style will not change

Ps::hover is suspended, that is, when suspended on a block, change the style of B C

"Front-end learning notes" about CSS changing the style of another block by one block

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.