即时通讯新的在HTML和仍在学习。 我试图保持一个按钮在中心(div),但我真的不知道我该怎么做。我用边缘来放置它。 - 当窗口全屏显示时效果很好,但当窗口变小时,按钮会改变位置。保持一个按钮(div)在中心
[对不起,如果英语是不完美的xD]
这里的按钮(CSS)的代码:
.signupbutton {
position:relative;
margin-left: 880px;
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #0d8f64), color-stop(1, #0d8f64));
background:-moz-linear-gradient(top, #0d8f64 5%, #0d8f64 100%);
background:-webkit-linear-gradient(top, #0d8f64 5%, #0d8f64 100%);
background:-o-linear-gradient(top, #0d8f64 5%, #0d8f64 100%);
background:-ms-linear-gradient(top, #0d8f64 5%, #0d8f64 100%);
background:linear-gradient(to bottom, #0d8f64 5%, #0d8f64 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0d8f64', endColorstr='#0d8f64',GradientType=0);
background-color:#0d8f64;
-moz-border-radius:14px;
-webkit-border-radius:14px;
border-radius:14px;
border:2px solid #424745;
display:inline-block;
color:#ffffff;
font-family:arial;
font-size: 16px;
font-weight:bold;
padding:12px 42px;
text-decoration:none;
text-shadow:0px -1px 0px #5b6178;
}
.signupbutton:hover {
background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #0d8f64), color-stop(1, #0d8f64));
background:-moz-linear-gradient(top, #0d8f64 5%, #0d8f64 100%);
background:-webkit-linear-gradient(top, #0d8f64 5%, #0d8f64 100%);
background:-o-linear-gradient(top, #0d8f64 5%, #0d8f64 100%);
background:-ms-linear-gradient(top, #0d8f64 5%, #0d8f64 100%);
background:linear-gradient(to bottom, #0d8f64 5%, #0d8f64 100%);
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0d8f64', endColorstr='#0d8f64',GradientType=0);
background-color:#0d8f64;
}
.signupbutton:active {
position:relative;
top:1px;
}
嘿,谢谢你这么快回答! :D无论如何,如果我有测试窗口全屏幕,这两个答案都能正常工作。但是,当我调整窗口的大小时,按钮会完全改变位置:S – user2713996