How to put this form below the header?

1

I'm now starting to study HTML, does anyone know how to put the form I created below the Header?

h1 {
  text-align: center;

}


/* caixa header */

.headerbox {
	padding: 30px;
  background: blue;
  color: white;
  text-align: center;
  position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);


}


body{
background: #396afc;  /* fallback for old browsers */
background: -webkit-linear-gradient(to left, #2948ff, #396afc);  /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to left, #2948ff, #396afc); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */

}
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8"/>
    	 <title>Document</title>
    	 <link rel="stylesheet" href="css/style.css">
 	</head>
 
 	<body>
     <!-- Conteúdo -->


	<header>
		<div class="headerbox">
  		<h1>Este é o título do site.</h1>
  		<p1>essa é uma chamada para o site.</p1>
 		</div>
	</header>


	<form action="/pagina-processa-dados-do-form" method="post">
    <div>
        <label for="nome">Nome:</label>
        <input type="text" id="nome" />
    </div>
    <div>
        <label for="email">E-mail:</label>
        <input type="email" id="email" />
    </div>
    <div>
        <label for="msg">Mensagem:</label>
        <textarea id="msg"></textarea>
    </div>
</form>



 </body>
</html>
    
asked by anonymous 24.12.2018 / 00:47

1 answer

0

First you need to abuse HTML5 semantics to organize your content. Generally, the <header> tag is in the header of the site.

Think of an Organization of the main tags:

  • header : Top of the site (Where menus and other navigations are usually found);
  • main : where your form will actually be;
  • footer : Where is the application footer;
  • section : usually, it is inside the main of your page, where there may be several, put your form here, for example!
  • article : If you have content of value, throw this content inside the article, which may also have sections inside it. It sits inside Main.

Now, let's go! Each tag of this, a BLOCK that goes from one end of the interface to another. Unless you model it.

So your form should look like this:

Follow the example in codepen: link

<main>
  <section>
      <div class="headerbox">
          <h1>Este é o título do site.</h1>
          <p1>essa é uma chamada para o site.</p1>
    </div>
    <div class="both">
          <form action="/pagina-processa-dados-do-form" method="post">
            <div>
                <label for="nome">Nome:</label>
                <input type="text" id="nome" />
            </div>
            <div>
                <label for="email">E-mail:</label>
                <input type="email" id="email" />
            </div>
            <div>
                <label for="msg">Mensagem:</label>
                <textarea id="msg"></textarea>
            </div>
        </form>
      </div>
  </section>
</main>

Do not forget to add the both class:

.both {
  position: absolute;
    left: 50%;
    top: 65%;
    transform: translate(-50%, -50%);
}
    
24.12.2018 / 01:06