<!DOCTYPE html>
seguida pela estrutura básica.<!DOCTYPE html>
<html>
<head>
<title>Minha Primeira Página</title>
</head>
<body>
<h1>Olá, Mundo!</h1>
<p>Este é meu primeiro site em HTML.</p>
</body>
</html>
<!DOCTYPE html>
indica HTML5.<html></html>
<h1> a <h6>
- Títulos e subtítulos<p>
- Parágrafos de texto<div>
- Divisão/seção genérica<span>
- Contêiner inline para texto<a>
- Links para outras páginas<img>
- Imagens<ul>, <ol>, <li>
- Listas<table>
- Tabelas<strong>
- Texto importante (negrito)<em>
- Texto enfatizado (itálico)<mark>
- Texto destacado (marcado)<del>
- Texto deletado (tachado)<br>
- Quebra de linha<hr>
- Linha horizontal (separador)<p>Texto com <strong>negrito</strong> e <em>itálico</em>.</p>
<p>Primeira linha<br>Segunda linha</p>
<b>
ou <i>
, pois elas ajudam na acessibilidade e SEO do seu site.<a>
<a href="https://www.exemplo.com">Visite o site</a>
<a href="contato.html">Página de contato</a>
<a href="#secao">Ir para seção</a>
target="_blank"
abre o link em uma nova aba.<img>
<img src="foto.jpg" alt="Descrição da imagem">
alt
é essencial para acessibilidade e SEO, descrevendo a imagem para leitores de tela e quando a imagem não carrega.<ul>
<ul>
<li>Maçã</li>
<li>Banana</li>
<li>Laranja</li>
</ul>
<ol>
<ol>
<li>Primeiro passo</li>
<li>Segundo passo</li>
<li>Terceiro passo</li>
</ol>
<li>
de outra lista.<table>
<thead>
<tr>
<th>Nome</th>
<th>Idade</th>
<th>Profissão</th>
</tr>
</thead>
<tbody>
<tr>
<td>Ana</td>
<td>25</td>
<td>Desenvolvedora</td>
</tr>
<tr>
<td>Pedro</td>
<td>32</td>
<td>Designer</td>
</tr>
</tbody>
</table>
<form>
- Container do formulário<input>
- Campo de entrada (texto, senha, etc.)<label>
- Rótulo para os campos<button>
- Botão de envio ou ação<form action="/processar" method="post">
<label for="nome">Nome:</label>
<input type="text" id="nome" name="nome">
<label for="email">Email:</label>
<input type="email" id="email" name="email">
<button type="submit">Enviar</button>
</form>
<header>
- Cabeçalho da página ou seção<nav>
- Menu de navegação<main>
- Conteúdo principal<section>
- Seção temática<article>
- Conteúdo independente<aside>
- Conteúdo relacionado indiretamente<footer>
- Rodapé da página ou seção<p style="color: blue; font-size: 16px;">Texto azul</p>
<head>
<style>
p { color: blue; font-size: 16px; }
</style>
</head>
<head>
<link rel="stylesheet" href="estilos.css">
</head>
/* Estilo para o corpo da página */
body {
background-color: #f5f5f5;
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
}
/* Estilo para títulos */
h1 {
color: #2c3e50;
font-size: 28px;
text-align: center;
}
/* Estilo para parágrafos */
p {
color: #34495e;
line-height: 1.6;
margin-bottom: 15px;
}
/* Estilo para uma classe específica */
.destaque {
background-color: #ffeaa7;
padding: 10px;
border-left: 3px solid #fdcb6e;
}
p { color: blue; }
.destaque { background-color: yellow; }
<p class="destaque">
#cabecalho { font-size: 24px; }
<div id="cabecalho">
. Um ID deve ser único na página.nav a { text-decoration: none; }
color
: Cor do textofont-family
: Tipo de fontefont-size
: Tamanho da fontefont-weight
: Peso da fonte (negrito)text-align
: Alinhamento do textoline-height
: Altura da linhamargin
: Espaço externo ao elementopadding
: Espaço interno ao elementobackground-color
: Cor de fundobackground-image
: Imagem de fundowidth
: Largura do elementoheight
: Altura do elementoborder
: Borda completaborder-radius
: Arredondamento da bordaLargura total = width + padding-left + padding-right
+ border-left + border-right
+ margin-left + margin-right
box-sizing: border-box;
para fazer com que a largura e altura definidas incluam o padding e a borda, tornando o cálculo mais intuitivo..container {
display: flex;
justify-content: space-between;
align-items: center;
}
display: flex
: Ativa o flexboxflex-direction
: row (padrão) ou columnjustify-content
: Alinhamento no eixo principalalign-items
: Alinhamento no eixo cruzadopx
: Pixels - tamanho fixo independente do dispositivo%
: Porcentagem relativa ao elemento paiem
: Relativo ao tamanho da fonte do elemento pairem
: Relativo ao tamanho da fonte do elemento raizvw/vh
: Porcentagem da largura/altura da viewportindex.html
!DOCTYPE
, html
, head
e body
h1
, uma imagem img
e um parágrafo p
a
para algum site<!DOCTYPE html>
<html>
<head>
<title>Minha Primeira Página</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Bem-vindo ao meu site</h1>
<img src="foto.jpg" alt="Minha foto">
<p>Esta é minha primeira página HTML.
Estou aprendendo desenvolvimento web.</p>
<a href="https://www.google.com">
Visite o Google
</a>
</body>
</html>
<head>
, adicione uma tag <style>
body
h1
<style>
body {
background-color: #f0f8ff;
font-family: Arial, sans-serif;
margin: 20px;
}
h1 {
color: #2c3e50;
text-align: center;
}
img {
max-width: 100%;
display: block;
margin: 0 auto;
}
p {
color: #34495e;
line-height: 1.6;
}
a {
color: #3498db;
text-decoration: none;
}
a:hover {
color: #e74c3c;
text-decoration: underline;
}
</style>
estilos.css
<style>
para este arquivo<link>
no <head>
/* No arquivo estilos.css */
.container {
display: flex;
gap: 20px;
}
.coluna {
flex: 1;
padding: 15px;
background-color: white;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
<!-- No arquivo index.html -->
<head>
<title>Minha Primeira Página</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="estilos.css">
</head>
<body>
<h1>Bem-vindo ao meu site</h1>
<div class="container">
<div class="coluna">
<img src="foto.jpg" alt="Minha foto">
</div>
<div class="coluna">
<p>Esta é minha primeira página...</p>
<a href="https://www.google.com">
Visite o Google
</a>
</div>
</div>
</body>
<form>
<h2>Entre em contato</h2>
<form>
<div>
<label for="nome">Nome:</label>
<input type="text" id="nome" name="nome"
required>
</div>
<div>
<label for="email">Email:</label>
<input type="email" id="email" name="email"
required>
</div>
<div>
<label for="mensagem">Mensagem:</label>
<textarea id="mensagem" name="mensagem"
rows="4" required></textarea>
</div>
<button type="submit">Enviar mensagem</button>
</form>