안녕하세요 .content 클래스의 너비와 높이를 변경하려고합니다. 하지만 언급하지 않더라도 100px 너비와 100 % 높이를 제공합니다. 나는 float를 제거하려고했지만 stil이 작동하지 않습니다. 이유가 무엇입니까?너비와 높이가 작동하지 않는 너비
<!DOCTYPE html>
<html>
<head>
<style>
body{margin:0}
#navbar{
width:100%;
background-color:black;
height:50px;
padding: 0 150px 0 150px;
position:relitive;
}
#logo{height:60px;
width:90px;
}
#container{
background-color:#E6E6E6;
width:78%;
margin: auto;
height:1000px;
text-align:center;
}
#navTable{
color:white;
position:absolute;
top:10px;
left:300px;
font-size:1.5em;
}
#navTable td{padding:0 10px 0 10px;
border-right:1px solid white;
}
#container div{width:32%;
height:100%;
border:1px solid black;
float:left;
}
.content{ /*this is not working[enter
background-color:yellow;
}
</style>
</head>
<body>
<div id='navbar'>
<img id='logo' src="http://i.cdn.cnn.com/cnn/.e/img/3.0/global/misc/cnn-logo.png"/>
<table id='navTable'>
<tr> <td>Home</td> <td>News</td> <td>Money</td> <td>Entertainment</td> <td>Travel</td> </tr>
</table>
</div>
<div id='container'>
<div id='leftDiv'>
<div class='content'>hhhh</div> <!--this-->
</div>
<div id='middleDiv'></div>
<div id='rightDiv'></div>
</div>
</body>
</html>
출력 : 여기에는 100px wide div와 비슷합니다.
그 이유는 당신이 #container의 DIV에 대한 스타일을 가지고 있고 그것은 결과에 영향을 미치는 것. CSS 우선 순위는 .container 클래스의 정의를 무시하는 이유입니다. – RLaaa