0
ブラウザを垂直方向にサイズ変更したときに画面上を移動するイメージの問題を解決する方法がわかりません。また、画像が画面上に移動するだけでなく、バナーのテキストと背景も移動し、バナーテキストがバナーから外れるようになります。スケーリングに問題 -
<!DOCTYPE html>
<html lang="en">
<head>
<title>A-level Revision Website</title>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" type="text/css" href="main.css">
<link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
</head>
<body>
<div class="banner">
<h1>A-Level Revision Website</h1>
</div>
<div>
<form id="loginForm">
<input type="email" class="login-username" autofocus="true" required="true" placeholder="Email" /><br>
<input type="password" class="login-password" required="true" placeholder="Password" /><br>
<input type="submit" name="Login" value="Login" class="login-submit" /><br>
<a href="#" class="login-forgot-pass">forgot password?</a>
</form>
</div>
<div id="imagesMain">
<a href="Maths.html">
<img src="images/Maths.jpg" alt="Maths">
</a>
<a href="ComputerScience.html">
<img src="images/Computer_Science.jpg" alt="ComputerScience">
</a>
<a href="Physics.html">
<img src="images/Physics.jpg" alt="Physics">
</a>
</div>
</html>
.banner{
position: absolute;
width: 100%;
height: 25%;
top: 0;
left: 0;
padding: 0;
margin: 0;
background-color: #595959;
color: #fff;
text-align: center;
line-height: 180px;
font-family: 'Lato', sans-serif;
font-size: 25px;
}
#imagesMain{
position: absolute;
max-width: 75rem;
left: 0;
right: 0;
margin: auto;
bottom: 0;
padding: 0;
margin: 20px auto;
text-align: center;
}
#imagesMain a{
width:30%;
float:left;
position:relative;
margin:1.5%;
}
img{
max-width: 100%;
height: auto;
margin-right: 25px;
position: relative;
}
body, html {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
display:table;
}
body {
display:table-cell;
vertical-align:middle;
}
form {
display:table;
margin:auto;
}
https://jsfiddle.net/zntzep48/7/
私の画像とログインフォームの両方が機能していますが、その位置はあります。画像はページの中央に配置され、ログインフォームはページの中央に配置されていたはずです。どのようにこの問題を解決するための任意のアイデアですか? – user7808079
は、ページ上の唯一のフォームですか? – Qwerty
ヘッダー、ログインフォーム、画像 – user7808079