2
I would like to align my label with the checkbox using CSS, so that the label does not get below the checkbox. Here’s a print of how I’d like it to look:
Mine is getting like this:
body {
display: flex;
background-color: #f5f5f5;
font-family: Arial, sans-serif;
}
section#principal {
width: 100%;
}
section#principal .modulo .container {
height: ;
padding: 20px;
}
section#principal .modulo .container .canvas {
background-color: #ffffff;
border: 1px solid #e6e6e6;
border-radius: 4px;
padding: 20px;
}
form ul {
padding: 0; margin: 0;
margin-bottom: 30px;
}
form li {
list-style: none;
margin-bottom: 10px;
}
form h2 {
font-size: 20px;
color: #161616;
padding: 0; margin: 0;
margin-bottom: 20px;
}
.confirmacoes li {
font-size: 14px;
display: block;
width: 400px;
}
.confirmacoes input {
width: 16px;
height: 16px;
margin-right: 5px;
vertical-align: middle;
position: relative;
}
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Projeto 008</title>
<link rel="stylesheet" href="normalize.css">
<link rel="stylesheet" href="estilo.css">
<script src="https://use.fontawesome.com/e0e1b97932.js"></script>
<meta name="viewport" content="width:device-width, initial-scale=1">
</head>
<body>
<section id="principal">
<div class="modulo">
<div class="container">
<div class="canvas">
<form action="">
<h2>Anythings</h2>
<ul class="confirmacoes">
<li>
<input type="checkbox">
<label>Güncelleme ve yenilikleri mail olarak almak istiyorum.</label>
</li>
<li>
<input type="checkbox">
<label>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras id nisl eget nunc molestie maximus.</label>
</li>
</ul>
</form>
</div>
</div>
</div>
</section>
</body>
</html>
This is very boring to do... The easiest thing is to declare a div pro box and another pro text and align the two by percentage. But be very careful in responsiveness.
– Lucas Thibau Paulino
If you are using the bootstrap, it does this to you automatically.
– Lucas Thibau Paulino
I was going to propose an answer, there is a lot of rule for something simple. But the answer has solved the problem, so ok. Just be careful about using flexbox in Internet Explorer. See the "known issues tab" on that website.
– Renan Gomes