中心形式的div和造型形式

时间:2017-12-05 01:26:57

标签: jquery html css

尝试做一些事情遇到了麻烦。尝试将表单放在需要电子邮件的位置,并且有“让我们说话”按钮。它应该位于“Lets get in touch”标题下方的中心位置

我也想给它一个投影但是我所拥有的不起作用。

最后看起来应该是这样的

enter image description here

这是我的代码的小提琴:https://jsfiddle.net/vcx4vm39/

以下是影响表单的所有css。

form{
 display: table;
margin: 0 auto;
}

#forth{
width: 100%

}

input[type=text], select {
width: 400px;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
/*     border: 1px solid #ccc; */
border-radius: 30px;
box-sizing: border-box;
font-family: proxima nova;

font-size: 14px;

position: absolute;

-webkit-box-shadow: 0px 0px 20px black rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0px 0px 20px black rgba(0, 0, 0, 0.5);
box-shadow: 0px 0px 20px black rgba(0, 0, 0, 0.5);


}

input[type=submit] {
width: 160px;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 30px;
cursor: pointer;
background-color: #0B315C;
font-family: proxima nova;
font-size: 14px;
font-weight: bold;
position: absolute;
margin: -10px 0px 0px 240px;

}

2 个答案:

答案 0 :(得分:2)

查看此更新的小提琴:https://jsfiddle.net/vcx4vm39/2/

在表单中添加了类.email-form并添加了以下CSS:

.email-form {
    width: 400px;
}

.email-form input {
    border: 0;
    box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
}

答案 1 :(得分:1)

从小提琴中移除了大部分不必要的代码。你现在可以看到它在中心。

编辑:感谢盒子阴影,转到第二个答案。



@import url('https://fonts.googleapis.com/css?family=Roboto');
@import url('https://fonts.googleapis.com/css?family=Roboto:bold');
@import url('https://fonts.googleapis.com/css?family=Roboto:100');
@import url('https://fonts.googleapis.com/css?family=Roboto:600');
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  top: 0;
  background-image: url('images/bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.logo {
  width: 150px;
  fill: white;
  display: block;
  position: relative;
  padding: 23px 0px 0px 50px;
}

.logo svg {
  position: absolute;
  top: 0px;
  right: 0px;
}

#hireus {
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px;
  font-family: proxima nova;
  font-size: 12px;
  text-decoration: none;
  color: white;
  margin: 27px 50px 0px 0px;
  text-decoration: none;
  z-index: 10;
}

.intro {
  height: 100%;
  width: 100%;
  margin: auto;
  display: table;
  /*
	top: 0;
	background-image: url('images/bg.png');
	background-size: cover;
	background-position: center;
    background-repeat: no-repeat;
*/
}

.intro .inner {
  display: table-cell;
  vertical-align: middle;
  width: 100%;
  max-width: none;
}

ul {
  list-style-type: none;
  overflow: hidden;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0.8;
  display: table;
  margin: 0;
  width: 100%;
  text-align: center;
  padding: 0
}

li {
  /*
	width: 120px;
	height: 40px;
*/
  margin: 0px 0px;
  display: inline-block;
  padding: 0;
  font-family: proxima nova;
  font-size: 10px;
  text-decoration: none;
}

.new a {
  display: block;
  /*
	width: 120px;
	height: 40px;
*/
  /* 	line-height: 40px; */
  text-decoration: none;
  text-align: center;
  color: white;
  /* 	margin: 20px 20px; */
  margin: 32px 20px 0px 20px;
}

.content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  padding-bottom: 7%;
}

.content h1 {
  font-family: proxima nova;
  font-size: 520%;
  font-weight: bold;
  color: white;
  margin: 0;
  padding-bottom: 3px;
}

.content p {
  font-family: proxima nova;
  font-size: 12px;
  font-weight: 100;
  color: white;
  margin: 0 auto;
  max-width: 420px;
  padding-bottom: 25px;
}

.btn {
  font-family: proxima nova;
  font-size: 14px;
  font-weight: bold;
  color: white;
  text-decoration: none;
  border: solid 1px white;
  /* 	padding: 10px 100px; */
  border-radius: 60px;
  transition: all 0.5s;
  width: 160px;
  display: inline-block;
  text-align: center;
  padding-top: 13px;
  padding-bottom: 13px;
}

.btn:hover {
  color: #b0ccff;
  border: solid 1px #b0ccff;
}

.btn2 {
  font-family: proxima nova;
  font-size: 14px;
  font-weight: bold;
  color: white;
  text-decoration: none;
  border: solid 1px #0B315C;
  /* 	padding: 10px 100px; */
  border-radius: 60px;
  transition: all 0.5s;
  width: 160px;
  background-color: #0B315C;
  display: inline-block;
  text-align: center;
  padding-top: 13px;
  padding-bottom: 13px;
  margin-left: 30px;
  -webkit-box-shadow: 0px 0px 20px black rgba(0, 0, 0, 0.5);
  -moz-box-shadow: 0px 0px 20px black rgba(0, 0, 0, 0.5);
  box-shadow: 0px 0px 20px black rgba(0, 0, 0, 0.5);
}

.btn2:hover {
  color: #b0ccff;
  border: solid 1px #b0ccff;
}

#scroll {
  color: green;
}

.title {
  font-family: proxima nova;
  font-size: 50px;
  font-weight: 600;
  color: black;
  text-align: center;
  margin-top: 60px;
  padding-bottom: 2px;
}

.subtitle {
  font-family: proxima nova;
  font-size: 12px;
  font-weight: 200;
  color: #9D9D9D;
  text-align: center;
  margin-top: -45px;
  padding-bottom: 2px;
}

#second {
  border-bottom: 1px solid #E6E6E6;
  width: 480px;
  margin: auto;
}

#Layer_1 {
  width: 100px;
  height: 100px;
}

#group2 {}

.whatwedo {
  text-align: center;
  width: 100%;
  margin-top: 100px;
}

.subject {
  text-align: center;
  width: 300px;
  display: inline-block;
  margin: 0px 50px;
}

.subject h2 {
  font-family: proxima nova;
  font-size: 20px;
  font-weight: 600;
  color: black;
  margin-bottom: 12px;
}

.desc {
  font-family: proxima nova;
  font-size: 12px;
  font-weight: 200;
  color: #9D9D9D;
}

.group3 {
  position: relative;
  text-align: center;
  color: white;
  margin-top: 90px;
}

.centered {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: proxima nova;
  font-size: 24px;
  font-weight: 100;
  color: white;
  width: 550px;
}

form {
  display: table;
  margin: 0 auto;
}

#forth {
  width: 100%
}

input[type=text],
select {
  width: 400px;
  padding: 12px 20px;
  margin: 8px 0;
  display: inline-block;
  /*     border: 1px solid #ccc; */
  border-radius: 30px;
  box-sizing: border-box;
  font-family: proxima nova;
  font-size: 14px;
  -webkit-box-shadow: 0px 0px 20px black rgba(0, 0, 0, 0.5);
  -moz-box-shadow: 0px 0px 20px black rgba(0, 0, 0, 0.5);
  box-shadow: 0px 0px 20px black rgba(0, 0, 0, 0.5);
}

input[type=submit] {
  width: 160px;
  background-color: #4CAF50;
  color: white;
  padding: 14px 20px;
  margin: 8px 0;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  background-color: #0B315C;
  font-family: proxima nova;
  font-size: 14px;
  font-weight: bold;
  position: relative;
  bottom: 42px;
  margin: -10px 0px 0px 240px;
}

.email-form {
  width: 400px;
}

.email-form input {
  border: 0;
  box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.2);
}


/*--- Media Queries --*/

@media screen and (max-width: 900px) {
  .content {
    padding-bottom: 10%;
  }
  .content h1 {
    font-size: 400%
  }
  .btn {
    font-size: 110%;
    padding: 9px 43px;
  }
}

@media screen and (max-width: 768px) {
  .content {
    padding-bottom: 12%;
  }
  .content h1 {
    font-size: 300%
  }
  .btn {
    font-size: 100%;
    padding: 9px 43px;
  }
}

@media screen and (max-width: 480px) {
  .content {
    padding-bottom: 14%;
  }
  .content h1 {
    font-size: 300%
  }
  .btn {
    font-size: 100%;
    padding: 10px 44px;
  }
}

<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>


<div id="forth">
  <h2 class="title">Lets get in touch</h2>
  <form action="mailto:contact@madebylaunchpad.com" method="post" enctype="text/plain" class="email-form">
    <input type="text" name="mail" placeholder="Your email address"><br>
    <input type="submit" value="Lets talk">
  </form>
</div>
&#13;
&#13;
&#13;

input[type=text], select {
//remove position:absolute;
}

input[type=submit] {
    position:relative;
  bottom:44px;
}