我不确定如何将密码输入字段、密码文本和提交按钮居中。我尝试过 text-align center 但我是新手,没有足够的经验来了解不同的方法。
任何帮助表示赞赏!
注意:如果您过于频繁地刷新页面,则 api 会受到限制并且 GIF 会消失,我会为这个问题将其更改为图像,但我认为这可能与它有关。
<!doctype HTML>
<html>
<head>
<meta name="websiteinnit" content="width=device-width, initial-scale=1">
<link rel=icon href="https://i.imgur.com/zWdbQf2.png">
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
$(function() {
var xhr = $.get("http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=no");
xhr.done(function(data) {
$('.gif-bg').css('background-image', 'url(' + data.data.image_url + ')');
});
});
</script>
</head>
<body>
<div class = "usernamecss">
<div class = "passwordcss">
<label class = "password" for = "password">Password:</label><br>
<input class = "passwordinput" type= "Password" id="password" name="password">
</div>
</form>
<div-1>
<input class = "submitbutton" type="submit" value="Submit">
</div-1>
<div class="gif-bg">
</div>
<style>
body {
margin: 100px;
}
.gif-bg {
background:url('') no-repeat center center;
min-height:10%;
min-width:10%;
Padding: 50px;
}
.password {
position:relative;
font-family: monospace;
font-size: 15px;
text-align:center;
outline:10px black;
position:absolute;
}
.passwordinput {
border-style: inset;
border-radius: 4px;
margin:4px;
text-align:center;
}
.submitbutton {
border-style: bold;
border-radius: 4px;
background-color: #BDD9BF;
transition-duration: 0.4s;
margin:4px;
}
.submitbutton:hover {
background-color: grey;
color: grey;
}
</style>
</body>
</html>