首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >浮动div不能正确浮动

浮动div不能正确浮动
EN

Stack Overflow用户
提问于 2012-01-10 06:33:35
回答 2查看 430关注 0票数 1

这是我在这里的第一个帖子,因为我已经束手无策了,所以我想我应该跳进去,最后寻求一些帮助!

我有一个我正在设计的网站上的“联系我们”部分,其中包含一个关于我们的小段落,电子邮件和电话。在它旁边有一个我从php form builder那里得到的电子邮件联系表单。一切都很顺利,直到我把那个坏男孩扔了进去。

任何人,这是我的代码联系我们‘包装器’:

代码语言:javascript
复制
#contact {
 background-image:url(img/contact_bg.jpg);
 background-repeat: no-repeat;
 width: 820px;
 height: 459px;
 margin: 25px 70px 50px 70px;
 clear: both;
 }

#thanks {
 width: 324px;
 height: 100px;
 padding-top: 35px;
 }

#thanks span {
  font-size: 1.5em;
  font-weight: normal;
  font-style: italic;
  letter-spacing:1px;
  color: #ffffff;
  text-shadow: 1px 1px 1px #000000;
  text-decoration: none;
  padding: 0 0 0 25px;
 }

#details {
 width: 324px;
 height: 63px;
 padding-top: 25px;
 clear: both;
  }

#details span {
 font-size: 1.115em;
 font-weight: normal;
 font-style: italic;
 letter-spacing:1px;
 color: #ffffff;
 text-shadow: 1px 1px 1px #000000;
 text-decoration: none;
 padding: 0 0 0 25px;
 clear: both;
 }

#about {
 width: 324px;
 clear: both;
 }

#about h2 {
 font-size: 1.618em;
 font-weight: normal;
 letter-spacing:1px;
 color: #ffffff;
 text-shadow: 1px 1px 1px #000000;
 padding-left: 25px;
 text-decoration: none;
 clear: both;
 }

#about span {
 font-size: 1em;
 font-weight: normal;
 letter-spacing:1px;
 color: #ffffff;
 text-shadow: 1px 1px 1px #000000;
 line-height: 14px;
 text-decoration: none;
 padding: 10px 0 0 25px;
 clear: both;
 }

这是我的表单css:

代码语言:javascript
复制
  #form {
   margin:0 auto;
   text-align:left;
   width:391px;
   height: 459px;
   float: right;
   }

  form.appnitro {
   margin:20px 20px 0;
   padding:0 0 20px;
   }

以下是一些截图:

这是它应该是什么样子的:

这就是它现在的样子:

任何帮助都是非常感谢的,如果你需要更多的信息,请让我知道。

非常感谢!

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-01-10 06:42:48

您的#thanks#about都是浮动的,所以您的联系人表单虽然是浮动的,但会显示在它们的下方。你需要同时浮点#thanks#about float:left

还有很多clear:both会重置文档流,这可能会导致您看到的一些问题。不过,如果不看实际的HTML,就很难说。

票数 1
EN

Stack Overflow用户

发布于 2012-01-10 06:46:31

您所需要做的就是在左侧的内容周围放入另一个div,并将其向左浮动,如下所示

代码语言:javascript
复制
<div style="float:left">
    <div id="thanks">
        <span>Thank you for your interest in Dan James construction. Please contact us using a method convenient for you.</span>
    </div>

    <div id="details">
        <span>Tel: 07749 121959</span>
        <span>Email: info@danjamesconstruction.com</span>
    </div>

    <div id="about">
        <h2>ABOUT US</h2>
        <span>Dan James construction are specialists in loft 
conversion based in North London and covering the whole of the M25 area.</span><span>We guide you through every stage of your 
development journey, right from the no obligation FREE estimate to the fine finishing touches.</span><span>So whether you're looking for more space or looking to add value get in touch today to start your very own conversion</span>
    </div>

</div>

这应该可以让我知道它的进展如何;-)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8796128

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档