How to move html input

Asked

Viewed 1,418 times

2

I wanted to move this login form to the center of the page but it won’t. I tried padding, text-ident, align, nothing does these input if you move, with the exception of the button nothing moves, even though I copied and pasted, it does not change places at all, so I will post the whole code.

Code:

body{ background-color: black;} body{ color: white;}

Firetecofficial-Access page

Login to access your account

<!--Sistema de Login-->

<form>
    <table> 
        <label for="login">Login:
        <input type="text" id="login" name="login" placeholder="Codigo do cidadão" size="10"><br />
        <label for="Senha">Senha:
        <input type="password" name="senha" placeholder="Senha" size="10"><br />
        <input style="text-indent: 1100px;" type="submit" name="botao-Acessar" value="Acessar" ><br />
        <input type="checkbox" name="manterconectado" value="Manter conectado"/> Manter conectado <br />
        <input style="text-indent: 1100px;" type="checkbox" name="termoseservicos" value="Li e Aceito os termos de uso"/> Li e Aceito os termos de uso<br />
     </table>
</form>
  • posts your html code. ps.: align and not Allign

  • Yuri edits your question and includes the CSS you are using

2 answers

2

If you want to centralize everything, you can use the display: flex, together with its alignment properties, in a <div> for the form, with this you can centralize the information, without losing the "indentation" of the elements and leaving the elements in the same line, as the checkbox.

You can understand more by taking a look at this guide.

Follow the example of use, below:

#containerForm{
  display:flex;
  justify-content:center;
  align-items:center;
}
<div id="containerForm">
  <form>
    <table> 
        <label for="login">Login:</label>
        <input type="text" id="login" name="login" placeholder="Codigo do cidadão"><br />
        <label for="Senha">Senha:</label>
        <input type="password" name="senha" placeholder="Senha"><br />
        <input type="submit" name="botao-Acessar" value="Acessar" ><br />
        <input type="checkbox" name="manterconectado" value="Manter conectado"/> Manter conectado <br />
        <input type="checkbox" name="termoseservicos" value="Li e Aceito os termos de uso"/> Li e Aceito os termos de uso<br />
     </table>
  </form>
</div>

  • Young man just a hint, when you put column vc "broke" some form items on different lines, see that now each input:checkbox is on a separate line, and the text below... originally by the pegunta code the checkbox was on the side of the text...

  • Visit this site: https://www.w3schools.com/css/css_positioning.asp Note: I commented only to add Gabriel’s answer. Anyway, what happens is that the site is English but it has very objective texts , can translate by google translator easily and will greatly enrich your form study if you want to use css in it.

  • I set it to be without breaking the elements, nor did it need column rs, vlw @hugocsl

  • 1

    @Gabrielsilva will give a read yes, vlw

1


Young man, first see you wear one table the way you used inside the form doesn’t make any sense, you can withdraw that tag...

Then just put text-align:center on the tag form that the entire content will be centralized, as the tags within the form are tag with scope inline

form {
  text-align: center;
}
  
<form>
    <label for="login">Login:
    <input type="text" id="login" name="login" placeholder="Codigo do cidadão" size="10"><br />
    <label for="Senha">Senha:
    <input type="password" name="senha" placeholder="Senha" size="10"><br />
    <input style="" type="submit" name="botao-Acessar" value="Acessar" ><br />
    <input type="checkbox" name="manterconectado" value="Manter conectado"/> Manter conectado <br />
    <input style="" type="checkbox" name="termoseservicos" value="Li e Aceito os termos de uso"/> Li e Aceito os termos de uso<br />
</form>

  • I decided to put the command <pre> even, nothing makes this form move.

  • @Yurikenpachi somewhere must have some css prescribing this alignment, if you have time to check one later or give me a touch here that I give you a strength

  • I don’t think this mistake is all very organized.

  • @Yurikenpachi considering only the code you posted in the question is difficult to tell you what you did there that is not accepting the style... Maybe some . external css or some template, or framework... But the fact is that for inline type elements as are the elements of the form the correct one would be the text-align.center itself

Browser other questions tagged

You are not signed in. Login or sign up in order to post.