我想 float 一个 <p>
到 <div>
的底部,但据我所知,我无法设置父项 <div>
至 position:relative
或 position:absolute
无需弄乱我的布局,它使用 Compass 的 Susy 框架。
我还能怎么做?
相关的 HTML 是:
<header>
<div class='grid'>
<div class='logo'>
<img src='/images/logo3.png'>
</div>
<div class='tagline'>
<p>Fast Facts About Your Website, Your Competition, And Best Practice</p>
</div>
</div>
</header>
相关的 CSS 是:
header {
clear: both;
}
.grid .logo {
width: 30.43478%;
float: left;
margin-right: 4.34783%;
display: inline;
padding-left: 3.75em;
margin: 0;
}
.grid .tagline {
width: 65.21739%;
float: right;
margin-right: 0;
#margin-left: -3.75em;
display: inline;
}
最佳答案
据我从你的问题中了解到你需要<p>
在你的 logo
下面在logo
之后清除你的 float div
My Fiddle
<div style="clear: both;"></div>
<div class='tagline'>
<p>Fast Facts About Your Website, Your Competition, And Best Practice</p>
</div>
为什么要使用 float 宽度?需要这么准确吗?为什么display: inline;
在 .logo
和 .tagline
关于css - 当你不能使用位置 :relative and position:absolute 时如何将 <p> float 到 <div> 的底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12872004/