我有以下 HTML
和 CSS
, Logo float 在左侧,但我希望内容 float 在右侧.
<html>
<body>
<div id="logo">
<img src="images/logo.gif" height="376" width="198" alt="LOGO" title="" />
</div>
<div id="maintext">
<p id="main">First paragraph</p>
<p>Second paragraph.</p>
</div>
<footer>...</footer>
</body>
</html>
在我的 CSS 中,logo
的选择器是:
#logo {
display: block;
float: left;
}
#maintext {
padding: 0 0.5em 0 0.5em;
}
发生的事情是 Logo “images/logo.gif
”出现在页脚的左侧但在页脚的顶部。它应该显示在“maintext”选择器的左侧。
有什么想法吗?
最佳答案
添加此 CSS:
footer {
clear: both;
}
关于css - Logo 向左浮动,内容向右浮动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19215104/