gpt4 book ai didi

html - 使用媒体查询的响应式网页

转载 作者:行者123 更新时间:2023-11-28 01:27:42 27 4
gpt4 key购买 nike

您好,我已经使用 HTML 和 CSS 创建了一个登录页面,但它不适合各种设备,即;没有响应。我怎样才能使用媒体查询使其响应。请提出任何解决方案。

 <html >
<head>
<meta charset="UTF-8">
<title>Log-in</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="login-card">
<h1>Login</h1><br>
<form>
<input type="text" name="user" placeholder="Name">
<input type="text" name="number" placeholder="Mobile Number">
<input type="submit" name="register" class="login login-register" value="Register">
</form>

</div>
</div>

</body>
</html>

这是我的 CSS

 body {
background: url() no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family: 'Roboto', sans-serif;
}

.login-card {
padding: 2px;
width: 100%;
background-color: #DCDCDC;
margin: 0 auto 10px;
border-radius: 1px 3px 2px;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
overflow: hidden;
}

.login-card h1 {
font-weight: 100;
text-align: center;
font-size: 2.3em;
}

.login-card input[type=submit] {
width: 100%;
display: block;
margin-bottom: 10px;
position: relative;
}

.login-card input[type=text], input[type=name] {
height: 44px;
font-size: 16px;
width: 100%;
margin-bottom: 10px;
-webkit-appearance: none;
background: #fff;
border: 1px solid #d9d9d9;
border-top: 1px solid #c0c0c0;
/* border-radius: 2px; */
padding: 0 8px;
box-sizing: border-box;
-moz-box-sizing: border-box;
border-radius:15px;
}

.login-card input[type=text]:hover, input[type=name]:hover {
border: 1px solid #b9b9b9;
border-top: 1px solid #a0a0a0;
-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.login {
text-align:center;
font-size: 14px;
font-family: 'Arial', sans-serif;
font-weight: 700;
height: 36px;
padding: 0 8px;
/* border-radius: 3px; */
/* -webkit-user-select: none;
user-select: none; */
}

.login-register {
/* border: 1px solid #3079ed; */
border: 0px;
border-radius:20px;
color: #fff;
text-shadow: 0 1px rgba(0,0,0,0.1);
background-color: #4d90fe;
/* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#4787ed)); */
}

.login-register:hover {
/* border: 1px solid #2f5bb7; */
border: 0px;
text-shadow: 0 1px rgba(0,0,0,0.3);
background-color: #357ae8;
/* background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#4d90fe), to(#357ae8)); */
}

最佳答案

为移动浏览器使用meta标签

<meta name="viewport" content="width=device-width, initial-scale=1">

https://developer.mozilla.org/en/docs/Mozilla/Mobile/Viewport_meta_tag

关于html - 使用媒体查询的响应式网页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31443878/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com