Я пытаюсь создать <form>
, где все параметры <input>
и <select>
выровнены так, как показано ниже: ![desired result](https://i.stack.imgur.com/tjflA.jpg)
Однако, это мой результат: ![my result](https://i.stack.imgur.com/NL4P7.jpg)
Как видите, текст <input>
выровнен правильно, но выпадающий список не совпадает с ними.Мой код ниже.
HTML :
<form id="survey-form">
<div class="row">
<label for="name">* Name:</label>
<input type="text" id="name" class="input-field" required placeholder="Enter your name">
</div>
<br>
<div class="row">
<label for="email">* Email:</label>
<input type="email" id="email" class="input-field" required placeholder="Enter your email">
</div>
<br>
<div class="row">
<label for="number">*Age:</label>
<input type="number" min="1" id="number" required class="input-field" placeholder="Age">
</div>
<br>
<div class="row">
<label for="role">Which option best describes your current role?</label>
<select name="role" id="role" class="input-select">
<option value="student">Student</option>
<option value="full-time-job">Full Time Job</option>
</div>
<option value="full-time-learner">Full Time Learner</option>
<option value="prefer-not-to-say">Prefer not to say</option>
<option value="other">Other</option>
</select>
</form>
CSS :
.row {
display: flex;
align-items: center;
justify-content: flex-end;
}
.input-field {
margin-left: 1em;
padding: .5em;
margin-bottom: .5em;
height: 20px;
width: 280px;
border: 1px solid gray;
border-radius: 2px;
}
.input-select {
margin-left: 1em;
padding: .5em;
margin-bottom: .5em;
width: 100px;
height: 40px;
border: 1px solid gray;
border-radius: 2px;
}
Я попытался настроитьjustify-content
, align-items
, display
и другие соответствующие CSS, но, похоже, ничто не могло связать мои <select>
и <input>
вместе.