Good morning everyone, I have some problem in aligning this form (Contact us) in the middle of the page. I utilise (I hope so) the flex propriety in a correct way, but why this form isn’t aligning?
So my question for you is:
- Could you help me understand why this form isn’t aligning correctly?
- Also could you suggest a way to align items horizontally and vertically in a proper way because I think my method isn’t correct.
Thanks in advance.
Here the code preview in codepen.io: https://codepen.io/maximo890/pen/oopdaz
CSS
.contact-us-form {
background-color: #f8bc3a;
}
.form-container {
}
form {
margin-top: 100px;
display: flex;
flex-direction: column;
justify-content: space-evenly;
width: 30%;
}
.formgeneric {
margin-top: 10px;
}
HTML
<section class="contact-us-form">
<div class="text-box-3">
<h2>CONTACT US</h2>
<p>Donec sed odio dui nulla vilae eli libem</p>
</div>
<div class="form-container">
<form>
<input type="text" name="fname" value="name" id="iname" class="formgeneric">
<input type="text" name="email" value="email" id="imail" class="formgeneric">
<textarea type="text" name="message" id="imessage" class="formgeneric">Message</textarea>
<input id="button" type="submit" value="submit" class="formgeneric">
</form>
</div>
</section>