我在使用display: block时发现了一些问题。
如果您打开此示例链接,您可以理解我的问题: http: //onofri.org/example/example3/
HTML 代码是:
<div id="container">
<div id="titleBox">
<p id="myTitle">Promoting Investment in Agriculture</p>
</div>
<div id="columns">
<div id="first">
<p>BLA BLA BLA</p>
<p>BLA BLA BLA</p>
<p>BLA BLA BLA</p>
</div>
<div id="second">
<p>BLA BLA BLA</p>
<p>BLA BLA BLA</p>
<p>BLA BLA BLA</p>
</div>
</div>
<div id="reportBox">
<p>REPORT</p>
<div id="flagsContainer">
<div id="reportEng"></div>
<div id="reportFrn"></div>
<div id="reportSpn"></div>
</div>
</div>
</div>
CSS代码是:
#titleBox{
margin: 0 auto;
width: 350px;
background-color: #6da662;
height: 40px;
position:relative;
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.28);
-moz-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.28);
-webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.28);
}
#myTitle{
/* consente di posizionare un elemento al centro del suo contenitore */
margin: 0 auto;
overflow: hidden;
color: #fff;
font-size: 16.5px;
font-weight: bold;
text-align: center;
vertical-align: middle;
line-height: 40px;
}
#columns{
display: block;
}
#reportBox{
margin: 0 auto;
margin-top: 25px;
width: 350px;
height: 150px;
background-color: #EFEFEF;
border: 1px solid #DFDFDF;
font-family: Verdana;
display: block;
}
#reportBox p{
text-align: center;
font-size: 12px;
font-weight: bold;
color: #004673;
padding-top: 5%;
}
#flagsContainer{
width: 222px;
height: 200px;
min-height: 200px;
margin: 0 auto;
}
#reportEng{
float: left;
width: 64px;
background-image: url(United-Kingdom2.png);
background-repeat: no-repeat;
margin-right: 10px;
height: 60%;
text-align: center;
}
#reportFrn{
float: left;
/*width: 133px;*/
background-image: url(France2.png);
background-repeat: no-repeat;
width: 64px;
height: 60%;
text-align: center;
margin-right: 10px;
}
#reportSpn{
float: left;
/*width: 133px;*/
background-image: url(Spain2.png);
background-repeat: no-repeat;
height: 60%;
width: 64px;
text-align: center;
}
#first{
/*background-color: #8FBC8F;*/
/* SFUMATURA BACKGROUND: */
background-image: -ms-linear-gradient(top, #35F2EC 0%, #16B7D6 50%, #016D94 100%);
background-image: -moz-linear-gradient(top, #35F2EC 0%, #16B7D6 50%, #016D94 100%);
background-image: -o-linear-gradient(top, #35F2EC 0%, #16B7D6 50%, #016D94 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #35F2EC), color-stop(0.5, #16B7D6), color-stop(1, #016D94));
background-image: -webkit-linear-gradient(top, #35F2EC 0%, #16B7D6 50%, #016D94 100%);
background-image: linear-gradient(to bottom, #35F2EC 0%, #16B7D6 50%, #016D94 100%);
width: 200px;
min-height: 300px;
border-radius: 10px;
float: left;
/*margin-right: 15px;*/
margin-bottom: 20px;
box-shadow: 6px 7px 15px rgba(0, 0, 0, 0.37);
-moz-box-shadow: 6px 7px 15px rgba(0, 0, 0, 0.37);
-webkit-box-shadow: 6px 7px 15px rgba(0, 0, 0, 0.37);
}
#second{
background-color: #8FBC8F;
width: 200px;
min-height: 300px;
border-radius: 10px;
float: right;
/*margin-left: 15px;*/
margin-bottom: 20px;
box-shadow: 6px 7px 15px rgba(0, 0, 0, 0.37);
-moz-box-shadow: 6px 7px 15px rgba(0, 0, 0, 0.37);
-webkit-box-shadow: 6px 7px 15px rgba(0, 0, 0, 0.37);
}
如您所见,在#titleBox div 下,我有一个名为#columns的容器div ,其中包含两个浮动列#first和#second
现在我希望#reportBox div 出现在#columns div下方的中心,而不是(现在)在两列之间。
试图选择这种行为,我尝试在#columns div 和#reportBox div 上设置display:block不起作用。
为什么?我该怎么做才能在#columns div下显示#reportBox?
肿瘤坏死因子
安德烈亚