【发布时间】:2017-10-30 16:03:06
【问题描述】:
我正在制作一个包含三个元素的页脚,一个 h3 和两个 div,所有元素都以边距百分比向右浮动。
问题是第三个元素(div2)在第一个 div 下方而不是向左浮动。
这是我的代码,我知道内联样式不是个好主意。
<div class="container" style="width:100%; height:70px; position:relative; float:left; padding:2%;">
<h3 style="float:left; position:relative; margin-right:15%; top:50%; transform:translateY(-50%); ">Contact our experts</h3>
<div class="telcontainer" style="margin-right:15%; width:auto; height:32px; position:relative; top:50%; transform:translateY(-50%); overflow:hidden; ">
<img src="https://images.petsmartassets.com/is/image/PetSmart/icon-experts-call?$GN1201$" style="width:32px; height:32px; position:relative; float:left;">
<h3 style="position:relative; float:left; margin-left:1%;">694003903</h3>
</div>
<div class="mailcontainer" style=" width:auto; height:32px; position:relative; top:50%; transform:translateY(-50%); overflow:hidden; ">
<img src="https://images.petsmartassets.com/is/image/PetSmart/icon-experts-call?$GN1201$" style="width:32px; height:32px; position:relative; float:left;">
<h3 style="position:relative; float:left; margin-left:1%;">Mail Us</h3>
</div>
</div>
【问题讨论】: