質問編集履歴
3
本文訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
フレームワークはBootstrapを使っていますが、Floating labelsのExmpleを使ったところ、
|
4
4
|
|
5
|
-
usernameとPasswordの
|
5
|
+
usernameとPasswordのinputタグの部分が画面中央ではなく、画面左上側に寄っています。
|
6
6
|
|
7
7
|
中央表示したく、調べてみたもののどれもうまくいきませんでした。
|
8
8
|
|
2
問題点の写真添付
test
CHANGED
File without changes
|
test
CHANGED
@@ -205,3 +205,7 @@
|
|
205
205
|
</html>
|
206
206
|
|
207
207
|
```
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
![イメージ説明](c3ecffefa17870c1f810c44c1a544298.png)
|
1
コードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -61,3 +61,147 @@
|
|
61
61
|
{% endblock content %}
|
62
62
|
|
63
63
|
```
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
修正1
|
68
|
+
|
69
|
+
```html
|
70
|
+
|
71
|
+
{% extends 'base.html' %}
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
{% block content %}
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
{% block customcss %}
|
80
|
+
|
81
|
+
<link href="{% static 'style_log.css' %}" rel="stylesheet">
|
82
|
+
|
83
|
+
{% endblock customcss %}
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<body class="text-center">
|
88
|
+
|
89
|
+
{{ context }}
|
90
|
+
|
91
|
+
<form method="POST">{% csrf_token %}<form>
|
92
|
+
|
93
|
+
<h1 class="h3 mb-3 fw-normal">Please login</h1>
|
94
|
+
|
95
|
+
<div class="form-floating" style="width:30%">
|
96
|
+
|
97
|
+
<input type="text" class="form-control" id="floatingInput" placeholder="Username" name='username'>
|
98
|
+
|
99
|
+
<label for="floatingInput">username</label>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
<div class="form-floating" style="width:30%">
|
104
|
+
|
105
|
+
<input type="password" class="form-control" id="floatingPassword" placeholder="Password" name='password'>
|
106
|
+
|
107
|
+
<label for="floatingPassword">Password</label>
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<button class="btn btn-lg btn-success" type="submit" style="width:30%">login</button>
|
112
|
+
|
113
|
+
<p class="mt-5 mb-3 text-muted">© 2017-2021</p>
|
114
|
+
|
115
|
+
</form>
|
116
|
+
|
117
|
+
</body>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
{% endblock content %}
|
122
|
+
|
123
|
+
```
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
```css
|
128
|
+
|
129
|
+
style_log.css
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
.form-floating > .form-control:focus ~ label, .form-floating > .form-control:not(:placeholder-shown) ~ label, .form-floating > .form-select ~ label {
|
134
|
+
|
135
|
+
width: 118%;
|
136
|
+
|
137
|
+
text-align: center;
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
コード
|
142
|
+
|
143
|
+
```
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
```html
|
148
|
+
|
149
|
+
base.html
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
<!doctype html>
|
154
|
+
|
155
|
+
<html lang="en">
|
156
|
+
|
157
|
+
<head>
|
158
|
+
|
159
|
+
<!-- Required meta tags -->
|
160
|
+
|
161
|
+
<meta charset="utf-8">
|
162
|
+
|
163
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<!-- Bootstrap CSS -->
|
168
|
+
|
169
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
{% block customcss %}
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
{% endblock customcss %}
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
<title>base.html</title>
|
182
|
+
|
183
|
+
</head>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
<body>
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
{% block header %}
|
192
|
+
|
193
|
+
{% endblock header %}
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
{% block content %}
|
198
|
+
|
199
|
+
{% endblock content %}
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
</body>
|
204
|
+
|
205
|
+
</html>
|
206
|
+
|
207
|
+
```
|