Estaba practicando html y css y me encontre con un problema al momento de querer centrar un input. Aqui el codigo en HTML y CSS.
*{
margin: 0;
}
form{
margin: 100px auto;
display: block;
background-color: #555;
padding: 20px;
width: 50% ;
text-align: center;
}
input{
padding: 6px;
width: 100%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="estilos.css">
<link href="https://fonts.googleapis.com/css2?family=Sen&display=swap" rel="stylesheet">
</head>
<body>
<form>
<input type="text" placeholder="Inserte su nombre aquí">
</form>
</body>
</html>
Espero puedan ayudarme a resolverlo, ya que por mas que revise, no entendi que estaba pasando.
display: flex;
alform
. Eso resolverá tu problema.