Ломается блок авторизации при масштабировании окна в браузере
При масштабировании окна в браузере ломается блок авторизации, перепробовал кучу всего, ничего не выходит.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
<style>
body {
font-family: Arial, Helvetica, sans-serif;
background-color: white;
position: relative;
}
H1 {
font-size: 150%;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.container {
width: 15%;
padding: 2%;
background: linear-gradient(MediumBlue, SteelBlue);
margin: 3% auto;
border-radius: 7%;
color: white;
text-align: center;
line-height: 40%;
font-size: 60%;
}
input[type=text], input[type=password] {
width: 90%;
padding: 7%;
margin: 0.5% 0 6% 0;
display: inline-block;
border: none;
background: #f1f1f1;
position: relative;
border-radius: 4%;
}
.registerbtn {
background: linear-gradient(LightSkyBlue, DodgerBlue);
color: white;
padding: 5% 10%;
margin: 0 auto;
border: none;
cursor: pointer;
width: 60%;
border-radius: 7%;
font-size: 200%;
margin-bottom: 0.5%;
}
</style>
</head>
<body>
<form action="/hello.php">
<div class="container">
<h1>C3000-HUB</h1>
<p>s/n MadiHub</p>
<input type="text" placeholder="login" name="login" required>
<input type="password" placeholder="password" name="password" required>
<button type="submit" class="registerbtn">Войти</button>
</div>
</form>
</body>
</html>
Ответы (1 шт):
Автор решения: Kirzzz
→ Ссылка
Так как ваша форма достаточно небольшая по размеру, то думаю можно сразу ей задать ширину статичной переменной. В противном случае можете сделать через @media что бы при масштабировании экрана изменялись первоначально заданные стили.
body {
font-family: Arial, Helvetica, sans-serif;
background-color: white;
position: relative;
}
H1 {
font-size: 150%;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
.container {
width: 12rem;
padding: 2%;
background: linear-gradient(MediumBlue, SteelBlue);
margin: 3% auto;
border-radius: 1rem;
color: white;
text-align: center;
line-height: 40%;
font-size: 60%;
}
input[type=text],
input[type=password] {
width: 90%;
padding: 7%;
margin: 0.5% 0 6% 0;
display: inline-block;
border: none;
background: #f1f1f1;
position: relative;
border-radius: 1rem;
}
.registerbtn {
background: linear-gradient(LightSkyBlue, DodgerBlue);
color: white;
padding: 0.5rem 1.75rem;
margin: 0 auto;
border: none;
cursor: pointer;
width: 60%;
border-radius: 1rem;
font-size: 200%;
margin-bottom: 0.5%;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width" />
</head>
<body>
<form action="/hello.php">
<div class="container">
<h1>C3000-HUB</h1>
<p>s/n MadiHub</p>
<input type="text" placeholder="login" name="login" required>
<input type="password" placeholder="password" name="password" required>
<button type="submit" class="registerbtn">Войти</button>
</div>
</form>
</body>
</html>
