I am trying to make a sign-up and log-in page like those of Instagram. I encounter difficulties in horizontal and centre alignment of the element and espacially to put the small horizontal bar. I have already spent a day on it, I need help please.
Here is my HTML and CSS code :
<body>
<div id="bloc_page">
<div id="formulaire">
<div id="titre">
Gestion TP-TD
</div>
<form>
<div class="form-group">
<input class="form-control" placeholder="Numéro de téléphone, @email ou nom utilisateur" type="text">
</div>
<div class="form-group">
<input class="form-control" placeholder="Mot de passe" type="password">
</div>
<div class="form-group">
<button class="btn btn-primary btn-lg btn-block">Sign In</button>
</div>
</form>
</div>
</div>
<div id="bloc_page">
<div id="lien"> Vous n'avez pas de compte? <a href="#">S'inscrire</a> </div>
</div>
</body>
#bloc_page {
background-color: #f5f5f5;
border: 1px solid black;
width: 37%;
margin: auto;
margin-top: 50px;
padding: 3%;
padding-bottom: 5px;
}
#titre {
vertical-align: middle;
font-style: italic;
font-weight: bold;
font-size: 2.0em;
}
#lien {
padding-bottom: 2px;
height: 20px;
}
3
Answers
use bootstrap grid system
CSS solution:
For
#titre
&#lien
, to align them vertically, you can try using theline-height
property.To align
#lien
horizontally, wrap the content in a<p>
tag and set thetext-align: center;
property.—
For the horizontal lines you can use the
<hr>
tag.I’d recommend looking into the bootstrap grid system either way though.
If you are using Bootstrap 3
Bootstrap 4
I tested on both and found that 4 didn’t recognize the xs class