Skip to content

Commit d0eba12

Browse files
committed
Style form and input layout
1 parent 3d7ed7d commit d0eba12

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

m3-we-are-the-champions/index.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ <h1 class="main__title">We are the Champions</h1>
2424
<label for="message-input" class="sr-only">Enter Your Endorsement:</label>
2525
<textarea type="text" rows="4" name="message" id="message-input" class="form__message" placeholder="Write your endorsement here" required></textarea>
2626

27-
<label for="from-input" class="sr-only">From:</label>
28-
<input type="text" name="from" id="from-input" class="form__name" placeholder="From" required>
27+
<div class="form__names">
28+
<label for="from-input" class="sr-only">From:</label>
29+
<input type="text" name="from" id="from-input" class="form__name" placeholder="From" required>
2930

30-
<label for="to-input" class="sr-only">To:</label>
31-
<input type="text" name="to" id="to-input" class="form__name" placeholder="To" required>
31+
<label for="to-input" class="sr-only">To:</label>
32+
<input type="text" name="to" id="to-input" class="form__name" placeholder="To" required>
33+
</div>
3234

3335
<button type="submit" class="form__btn">Publish</button>
3436
</form>

m3-we-are-the-champions/styles.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,25 +140,53 @@ h1, h2 {
140140
}
141141

142142
/* Form section */
143+
.form,
144+
.form__names {
145+
display: grid;
146+
gap: 0.7rem;
147+
}
148+
143149
.form__message,
144150
.form__name {
145151
background-color: var(--clr-input-bg);
146152
color: var(--clr-white);
147153
border-radius: var(--border-radius);
148154
border: none;
155+
padding: 0.7rem 1rem;
156+
width: 100%;
149157
}
150158

151159
.form__message::placeholder,
152160
.form__name::placeholder {
153161
color: var(--clr-placeholder);
154162
}
155163

164+
.form__message:focus,
165+
.form__name:focus {
166+
outline: 0.15em solid var(--clr-white);
167+
}
168+
169+
.form__names {
170+
grid-template-columns: 1fr 1fr;
171+
}
172+
173+
.form__name {
174+
text-align: center;
175+
}
176+
156177
.form__btn {
157178
font-family: var(--ff-title), Arial, Helvetica, sans-serif;
158179
font-weight: 700;
159180
background-color: var(--clr-btn-bg);
160181
border: none;
161182
border-radius: var(--border-radius);
183+
padding: 0.8rem;
184+
font-size: 1.3rem;
185+
}
186+
187+
.form__btn:focus {
188+
outline: 0.2em solid var(--clr-btn-bg);
189+
outline-offset: 0.15em;
162190
}
163191

164192
/* Endorsements section */

0 commit comments

Comments
 (0)