我需要圖像下方的輸入字段並且不對齊。我將如何進行水平和垂直居中圖像和輸入字段(+按鈕)。截至目前輸入字段是在圖像旁邊,我希望它下面的圖像。如何將圖像和輸入字段放在頁面的中間和中間?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Solution for Technigo Coding Challenge</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<style>
body{
background-color:#18344e;
}
div {
position:absolute;
top:0;left:0;right:0;bottom:0;
background: g;
display: flex;
align-items: center;
justify-content:center
}
</style>
</head>
<body>
<div>
<center><img><a href=><img src="http://i.imgur.com/jl99RSf.gif" title="source: imgur.com" /></a></img></center>
<form action="/action_page.php"><center><form>
<strong>Search</strong>:<input type="text">
<input type="submit"value="Enter"></form></center>
</div>
<body/>
</html>
非常感謝!它水平居中,但也想垂直居中。你會知道如何去做這件事嗎?我希望輸入字段在圖像下方。謝謝你,謝謝 –
已經有一個答案[這裏](https://stackoverflow.com/a/6182661/5894241),顯示你可以做到這一點。下面是我創建的一個小提琴,展示瞭如何將它應用於HTML:https://jsfiddle.net/09z4v72j/ – Nisarg