CRIAÇÃO LAYOUT DO HTML5

CRIAÇÃO LAYOUT DO HTML5


<header> define o cabeçalho do documento ou seção.

<nav>   è um conjunto de link principal (MENU PRINCIPAL)

<section> Define uma seção de um documento.

<article> Conteúdo independente e independente.

<aside> Define o conteúdo com uma barra lateral.

<footer> Define rodapé do documento ou seção.

<details> Define detalhes adicionais que o usuário pode abrir e fechar sob demanda.

<summary> Define um título para o <details> elemento

Técnicas de Layout HTML

Existem quatros técnica diferente para criar layout com várias colunas.

  • estrutura CSS
  • Propriedade flutuante do CSS
  • CSS flexbox
  • Grade CSS

Estruturas CSS

Esquema Flutuante CSS

NA PRÁTICA

<!DOCTYPE html>

<html lang="pt-BR">

<head>

<title>layout da página</title>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

* {

  box-sizing: border-box;

}

 

body {

  font-family: Arial, Helvetica, sans-serif;

}

 

/* Style do header */

header {

  background-color: #000;

  padding: 20px;

  text-align: center;

  font-size: 20px;

  color: white;

}

 

/* Create two columns/boxes that floats next to each other */

nav {

  float: left;

  width: 30%;

  height: 300px; /* only for demonstration, should be removed */

  background: #ccc;

  padding: 20px;

}

 

/* Style the list inside the menu */

nav ul {

  list-style-type: none;

  padding: 0;

}

 

article {

  float: left;

  padding: 20px;

  width: 70%;

  background-color: #f1f1f1;

  height: 300px; /* only for demonstration, should be removed */

}

 

/* Clear floats after the columns */

section::after {

  content: "";

  display: table;

  clear: both;

}

/* Style the footer */

footer {

  background-color: #777;

  padding: 10px;

  text-align: center;

  color: white;

}

/* Responsive layout - makes the two columns/boxes stack on top of each other instead of next to each other, on small screens */

@media (max-width: 600px) {

  nav, article {

    width: 100%;

    height: auto;

  }

}

</style>

</head>

<body>

<h2>Layout Flutuante</h2>

<p> Primeira página html5 </p>

<header>

  <h2>LUGARES</h2>

</header>

<section>

  <nav>

    <ul>

      <li><a href="#">BRASÍLIA</a></li>

      <li><a href="#">SÃO PAULO</a></li>

      <li><a href="#">RIO DE JANEIRO</a></li>

    </ul>

  </nav>

  <article>

    <h1>BRASÍLIA</h1>

    <p> Brasília é a capital do Brasil</p>

  </article>

</section>

<footer>

  <p>RODAPÉ</p>

</footer>

</body>

</html>

Esquema CSS Flexbox

NA PRÁTICA

<!DOCTYPE html>

<html lang="pt-BR">

<head>

<title>Layout do site</title>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

* {

  box-sizing: border-box;

}

 

body {

  font-family: Arial, Helvetica, sans-serif;

}

 

/* Style the header */

header {

  background-color: #000;

  padding: 30px;

  text-align: center;

  font-size: 35px;

  color: white;

}

 

/* Container for flexboxes */

section {

  display: -webkit-flex;

  display: flex;

}

 

/* Style the navigation menu */

nav {

  -webkit-flex: 1;

  -ms-flex: 1;

  flex: 1;

  background: #ccc;

  padding: 20px;

}

 

/* Style the list inside the menu */

nav ul {

  list-style-type: none;

  padding: 0;

}

 

/* Style the content */

article {

  -webkit-flex: 3;

  -ms-flex: 3;

  flex: 3;

  background-color: #f1f1f1;

  padding: 10px;

}

 

/* Style the footer */

footer {

  background-color: #777;

  padding: 10px;

  text-align: center;

  color: white;

}

 

/* Responsive layout - makes the menu and the content (inside the section) sit on top of each other instead of next to each other */

@media (max-width: 600px) {

  section {

    -webkit-flex-direction: column;

    flex-direction: column;

  }

}

</style>

</head>

<body>

 

<h2>CSS Layout Flexbox</h2>

<p> Primeiro layout usando flexbox</p>

 

<header>

  <h2>Lugares</h2>

</header>

 

<section>

  <nav>

    <ul>

      <li><a href="#">Brasília</a></li>

      <li><a href="#">São paulo</a></li>

      <li><a href="#">Rio de Janeiro</a></li>

    </ul>

  </nav>

 

  <article>

    <h1>Brasília</h1>

    <p> Brasília  éa capital do Brasil.</p>

  </article>

</section>

 

<footer>

  <p>Rodapé</p>

</footer>

 

</body>

</html>