我有一个边栏(侧边栏),我试图将它分成 3 个部分。这是它的样子:
这是我的html:
<aside id="sidebar">
<div id="side_events">
Events
</div>
<div id="side_trailer">
Trailer
</div>
<div id="side_advertisement">
Advertisement
</div>
</aside>
这是我的大部分 CSS:
* {
margin: 0px;
padding:0px;
}
header, section, footer, aside, nav, article, hgroup{
display: block;
}
body{
width: 100%; /*always specify this when using flexBox*/
height:100%;
display: -webkit-box;
text-align:center;
-webkit-box-pack:center; /*way of centering the website*/
background-image:url('bg2.jpg');
}
#wrapper{
max-width: 850px;
display: -webkit-box; /*means this is a box with children inside*/
-webkit-box-orient:vertical;
-webkit-box-flex: 1; /*allows site to grow or shrink 1 = flex 0 = statix*/
background-color: #B137D6;
}
#body_div{
display: -webkit-box;
-webkit-box-orient:horizontal;
color:#000000;
}
#main_section{
border:1px solid blue;
-webkit-box-flex: 1;
margin: 20px;
padding: 3px;
}
#sidebar{
width: 210px;
height: 100%;
margin: 20px;
padding: 0px;
background: #999999;
border:#FF0000 1px solid;
}
#side_events,
#side_trailer,
#side_advertisement{
height:33.333%;
}
#side_events{
background:#102A50;
display:block;
}
#side_trailer{
background:#173B72;
display:block;
}
#side_advertisement{
background:#296CD0;
display:block;
}