我想在那个特定的 div 中消失我的表单,但是我的表单在整个浏览器宽度中移动......请帮助我..
css
#div {
position : relative;
width:500px;
height:300px;
background-color:#888;
margin-left:25%;
text-align : center;
padding:5%;
margin-top:100px;
}
#main {
position: absolute;
border: 1px solid #ccc;
padding: 5px;
width: 300px;
margin-left: 15%;
border-top :10%;
}
js
$("document").ready(function(){
$("#submit").click(function(){
var name1 = $("#name").val();
var email = $("#email").val();
$("#main").animate({"left":"-=1000px"},"fast",function(){
$(this).after("Thank you"+" "+ name1+"."+ "<br>" + "Your email is" + " " + email);
});
});
});
html
<div id="div">
<div id="main">
<h3>Personal Details</h3>
Name<input type="text" style="margin-left:10%" id="name"/><br><br>
Email<input type="text" style="margin-left:11%"id="email"/><br><br>
<button id="submit">submit</button>
</div>
</div>