【问题标题】:Contact Form Div Is Overlapping Footer联系表格 Div 与页脚重叠
【发布时间】:2019-08-07 07:03:06
【问题描述】:

我正在制作自己的作品集,并希望在其上添加联系表格。但是包含表单的 div 与小屏幕中的页脚重叠。您可以通过运行代码 sn -p 来查看问题。谁能帮我解决这个问题?这将是一个很大的帮助。非常感谢。

#contactus {
    height: 105vh;
    margin: 0 auto -80px;
    position: relative;
    z-index: 1;
}

#formContainer{ width: 85%;  margin: 0 auto; background-color: aqua;   }

.contactHead{ text-align: center}

.footer{
  height:250px;
  background-color:#1e1e1e;
  text-align:center;
  display:flex;
  align-items:center;
  justify-content:center;
}
.footer h2{
  
  color: #fff;
  
}
<div id="contactus">
	
	<div id="formContainer">
		<h1 class="contactHead">Get In Touch!</h1>
		<h4 class="contactHead">I will be with you within 24 hours</h4>
		
		<form id="contactForm">
		<input type="text" id="nameContainer" placeholder="Name">
		<br>
		<br>
		<input type="email" id="emailContainer" placeholder="Email Address">
			
		<br>
		<br>
		<input type="text" id="messageContainer" placeholder="Message">
			
		<br>
		<br>
		<input type="submit" value="Send Message">
		</form>
		
	</div>
	
</div>

<div class="footer">
  <h2>Footer</h2>
  
</div>

【问题讨论】:

    标签: css contact-form overlapping


    【解决方案1】:

    负边距和高度搞砸了。有这个高度和负边距的原因是什么?

    #contactus {
      margin: 0 auto;
      position: relative;
      z-index: 1;
    }
    
    #formContainer {
      width: 85%;
      margin: 0 auto;
      background-color: aqua;
    }
    
    .contactHead {
      text-align: center
    }
    
    .footer {
      height: 250px;
      background-color: #1e1e1e;
      text-align: center;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .footer h2 {
      color: #fff;
    }
    <div id="contactus">
    
      <div id="formContainer">
        <h1 class="contactHead">Get In Touch!</h1>
        <h4 class="contactHead">I will be with you within 24 hours</h4>
    
        <form id="contactForm">
          <input type="text" id="nameContainer" placeholder="Name">
          <br>
          <br>
          <input type="email" id="emailContainer" placeholder="Email Address">
    
          <br>
          <br>
          <input type="text" id="messageContainer" placeholder="Message">
    
          <br>
          <br>
          <input type="submit" value="Send Message">
        </form>
    
      </div>
    
    </div>
    
    <div class="footer">
      <h2>Footer</h2>
    
    </div>

    【讨论】:

    • @JanithSiribaddana 如果有帮助请接受答案
    • 完成。对不起。我之前不知道
    • @JanithSiribaddana 仍然没有接受,答案的开头应该有一个复选框,其中 0 是
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-24
    • 1970-01-01
    • 1970-01-01
    • 2019-10-02
    • 1970-01-01
    • 1970-01-01
    • 2012-12-08
    相关资源
    最近更新 更多