它如果妳這樣做它應該工作:
HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
<div id="parent">
<div id="child" class="child">
<div id="grandChild" class="child">
</div>
</div>
</div>
</body>
</html>
CSS:
#parent{
height: 200px;
width: 200px;
background-color: red;
}
#grandChild{
height: 50px;
width: 50px;
background-color: lightgreen;
border-radius: 20%;
}
#parent>.child{
height: 100px;
width: 100px;
background-color: lightblue;
border-radius: 50%;
}
在下面的演示嘗試改變#parent> .child到#父母.child,並看到不同之處。
WORKING DEMO
也許你忘了給高度和寬度給你的div div我正如上面在評論中所說的?
希望有幫助。
沒有更多的信息,它很難確定。你可以設置一個[jsfiddle](https://jsfiddle.net/)或者嘗試在瀏覽器中運行該文件來縮小可能性嗎? –
你給你的寬度和高度的div divs? –