HTML:
<body>
<div><p>Something</p></div>
<div class = "myPanel">
<div class = "heading">my header</div>
<div class = "body">my body</div>
</div>
<div><p>Something</p></div>
</body>
css:
.myPanel: {
border: 1px solid #687D6D;
border-radius: 5px 5px 0 0;
box-shadow: 10px 10px 1px black;
margin: 3%;
}
.myPanel .heading {
background: #B6F0C4;
border-radius: 5px 5px 0 0;
color: #687D6D;
padding: 10px 20px;
}
.myPanel .body {
padding: 10px 20px;
}
What I'm curious is that, even if I set border
on .myPanel
, it doesn't work on .myPanel .body
, there's no border around .myPanel .body
, why?
here is your problem:
.myPanel: {
just remove the : (colon)
snippet below:
.myPanel { border: 1px solid #687D6D; border-radius: 5px 5px 0 0; box-shadow: 10px 10px 1px black; margin: 3%; } .myPanel .heading { background: #B6F0C4; border-radius: 5px 5px 0 0; color: #687D6D; padding: 10px 20px; } .myPanel .body { padding: 10px 20px; }
<div> <p>Something</p> </div> <div class="myPanel"> <div class="heading">my header</div> <div class="body">my body</div> </div> <div> <p>Something</p> </div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.