我花时间为我的主要内容格式化一个 div 标签,然后我把那个 div 放在一个包装 div 中。好吧,当我将我的 Logo 添加到网站时,一切都发生了变化。 Logo 所在的 div 似乎已将包装标签向下推。作为代码的新手,我试图让我的设计尽可能干净,但它正在分崩离析。有什么建议么?有什么帮助吗?在 fiddle 中,我在 img 源代码中启动了 HTML 代码,这是添加后将我的内容向下推的图像。
这是 fiddle http://jsfiddle.net/569Gm/
<div id="logo">
<img src="images/logo/logo-vector.png" />
</div>
<div id="wrapper">
<div id="aboutus">
<p>We are a Hagerstown-based junk removal and moving service. Able to accomplish jobs both big and small, we accept residential, commerical, and industrial jobs. </p>
<p> </p>
<p>Active since 2014, we are a relatively new service looking to help as many people as possible. Visit our Facebook Page to stay posted on our recent works, job openings, special offers and more. </p>
</div>
<div id="scheduling">
<p>To schedule for a service, please provide the information listed
below and we will respond promptly.</p>
</div>
<div id="contactus">
<p>If you have any questions, comments, or concerns, our contact information is listed below.</p>
<p> </p>
<p>Phone: (443) 690 6421</p>
<p>Email: service@hagdustboy.com</p>
</div>
</div>
</body>
</html>
</div>
这就是我添加 Logo 后我的网站的样子。 http://www.pixentral.com/show.php?picture=1PYUTuzOhcbLcaoadEpTNk2qnm
最佳答案
将 float:left;
添加到你的 #logo
中,并使用 clear:left;
而不是 clear:both;
.
通过添加 float:left;
& clear:left;
#wrapper
将与您的 Logo 内联。
查看Demo
关于html - 如何防止我的 div 标签相互移动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25148244/