联系表格Div重叠页脚

时间:2019-03-16 09:58:27

标签: css contact-form overlapping

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

#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>

1 个答案:

答案 0 :(得分:0)

负边距和高度使事情变得混乱。具有该高度和负边距的原因是什么?

#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>