0
The thing is, I’m making a form and I want the label to be on top of the input, but I couldn’t get it because I used the float: left
to leave the inputs side by side, but I want instead to look like this:
Keep the label "Enter your name ..." for example, on top of the input "Enter your name" and so on
This is my comic css:
.form{
width:80%;
height:750px;
border-radius:4px;
border:2px solid #fff;
background:#fff;
margin-top:150px;
color:black;
}
.form .navbar_form {
width:100%;
height:60px;
background:#a0a0a0;
}
.form .navbar_form img{
width:50px;
height:50px;
border-radius:50%;
object-fit:cover;
float:left;
margin-top:5px;
margin-left:20px;
}
.form .navbar_form h1{
padding:10px;
color:#fff;
letter-spacing:2px;
text-transform:uppercase;
font-family:Arial;
}
.form input[type="text"]{
position:relative;
margin:10px;
top:15%;
left:8%;
border:none;
outline:none;
border-bottom:1px solid red;
background:transparent;
width:40%;
height:30px;
float:left;
}
.form button{
float:right;
margin-right:40px;
width:35%;
border:none;
outline:none;
height:40px;
color:#fff;
background:#fb2525;
font-size:18px;
border-radius:20px;
}
.form #action_Card {
position:relative;
top:60%;
display:inline-block;
width:100%;
height:40px;
background:yellow;
}
My html:
<center><form action="/cad" method="POST">
<div class="form">
<div class="navbar_form">
<img src="/img/logo.jpeg">
<h1>Cadastro de usuarios</h1>
</div>
<label>Insira seu nome:*</label>
<input type="text" name="nome" placeholder="Insira seu nome"/>
<label>Insira seu sobrenome:*</label><br>
<input type="text" name="sobrenome" placeholder="Insira seu sobrenome"/> <label>Insira seu nome de usuario:*</label><br> <input type="text" name="username" placeholder="Insira seu usuario"/> <label>Insira seu email:*</label><br> <input type="text" name="email" placeholder="Insira seu email"/> <label>Insira sua senha:*</label><br> <input type="text" name="password" placeholder="Insira sua senha"/> <label>Confirme sua senha:*</label>
<input type="text" placeholder="Confirme sua senha"/>
<div id="action_Card">
<button type="button">Criar conta</button>
</div>
</div>
Guys, I’ll adjust the position of the div better actionCard
and take that yellow background later, just put it so I can see better.
you could tell me why there’s room in class
form-col form-col-3
and the name of it, I want to search to understand better, because when I create a class I don’t use space, I don’t understand why people use without space I want to see on Youtube to see if I understand it better– Dakota
I answered wrong to you by rereading your question... in the assignment of class in objects you can add several classes for that you must use space between them, then the reference "form-col form-col-3" informs that the object will inherit properties of 2 classes, could be more or less classes, already the character "-" is a matter of nomenclature, you could use Formcol3 or formcol3 but note that the form we write can facilitate the visualization.
– Marcelo