我是CSS的noob,我在玩CSS和DIVS,一切都很順利,直到我決定把2個Div放入一。我可以把ONE div放在另一個裏面,但是當我把2放在另一個裏面的時候,它只是個bug。 I could put the green Div inside of yellow div but not the cyan在1 Div內插入2個div(一個在左側,另一個在右側)
這裏是我的HTML:
<html>
<head>
<link type="text/css" rel="stylesheet" href="style_divs.css">
</head>
<body>
<div id="table">
<div id="year">2017</div>
<div id="month">
<div id="previousMonth">Previous</div>
<div id="nextMonth">Next</div>
January
</div>
</div>
</body>
</html>
CSS
#table{
width:25%;
height:50%;
background-color: red;
margin: 0 auto;
}
#year{
width:100%;
height:10%;
background-color: blue;
margin: 0 auto;
text-align: center;
}
#month{
width:100%;
height:10%;
background-color: yellow;
margin: 0 auto;
text-align: center;
}
#previousMonth{
width:12%;
height:100%;
background-color: green;
margin-left: 0%;
text-align: center;
}
#nextMonth{
width:12%;
height:100%;
background-color: cyan;
margin-left: 88%;
text-align: center;
}
感謝。
你有沒有試過'浮動''divs'? –
你真正的問題是什麼? –
謝謝。我現在感覺非常愚蠢。 –