flexでjustify-content
プロパティとalign-items
プロパティにcenter
を指定することで実現できると思いますが、いかがでしょうか?
HTML
1<!DOCTYPE html>
2<html lang="ja">
3<head>
4 <meta charset="UTF-8">
5 <style type="text/css">
6 * {
7 margin: 0;
8 padding: 0;
9 }
10
11 html, body, .form1 {
12 width: 100%;
13 height: 100%;
14 }
15
16 .form1 {
17 display: flex;
18 justify-content: center;
19 align-items: center;
20 }
21 </style>
22</head>
23<body>
24<div class="form1">
25 <form method="post" action="#">
26 <label>
27 <input type="text" name="keyword" class="txt">
28 </label>
29 <label>
30 <input type="submit" value="検索" class="send">
31 </label>
32 </form>
33</div>
34</body>
35</html>
追記
HTML
1<!DOCTYPE html>
2<html lang="ja">
3<head>
4 <meta charset="UTF-8">
5 <style type="text/css">
6 * {
7 margin: 0;
8 padding: 0;
9 }
10
11 html, body, .form1 {
12 width: 100vw;
13 height: 100vh;
14 }
15
16 .form1 {
17 display: flex;
18 justify-content: center;
19 align-items: center;
20 background-color: black;
21 }
22
23 input.txt {
24 min-width: 45vw;
25 height: 30px;
26 }
27
28 input.send {
29 min-width: 5vw;
30 height: 30px;
31 }
32 </style>
33</head>
34<body>
35<div class="form1">
36 <form method="post" action="#">
37 <label>
38 <input type="text" name="keyword" class="txt">
39 </label>
40 <label>
41 <input type="submit" value="検索" class="send">
42 </label>
43 </form>
44</div>
45</body>
46</html>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2017/05/31 11:37