【发布时间】:2013-06-16 13:10:43
【问题描述】:
我有 2 个 div,它们在一个 div 中。就像在代码中一样:
HTML:
<div class="main" style="clear: both;">
<div class="text">
/text is here
</div>
<div class="sponsors">
<img src="images/Sponsors/asfalpan.png" alt="Asfalpan" width="285">
</div>
</div>
CSS:
.main {
width: 1000px;
margin-left: auto;
margin-right: auto;
position:relative;
background-color:#232021;
border-radius: 50px;
}
.text {
width: 700px;
padding-left:10px;
padding-top: 20px;
padding-bottom: 20px;
position:relative;
font-family: Gisha;
color: white;
font-size:14px;
}
.sponsors {
margin-left: 710px;
margin-top: 20px;
position: relative;
font-family: Gisha;
color: white;
font-size: 14px;
background-color: #E5173E;
}
所以我希望 .sponsors 和 .text 在 .main 中彼此相邻 但由于某种原因,这不会发生。他们出现在彼此之下。我该如何解决这个问题?
【问题讨论】: