Introdução ao HTML
Sintase do HTML
Tags
Estrutura de uma tag
openning closing
tag content tag
┌┴┐┌────────────────┐┌─┴─┐
<p>Lorem ipsum dolor.</p>
└────────────────────────┘
ElementEstrutura de uma tag
openning closing
tag content tag
┌┴┐┌────────────────┐┌─┴─┐
<p>Lorem ipsum dolor.</p>
└────────────────────────┘
ElementExemplos:
- Cabeçalho:
<title>,<link>,<style>,<meta>, outros - Texto:
<p>,<b>,<i>,<h1-6> - Lista:
<ul>,<ol>,<li>,<dl>,<dt>,<dd> - Hiperlink:
<a> - Tabela:
<table>,<tr>,<th>,<td> - Imagem:
<img>
Mais exemplos: HTML Reference | MDN
Referências:
- Elementos
- Categorias
Atributo de tag
Formato de atributo de tag
attribute (chaves="valor")
┌─────┴────┐
<p lang="pt-BR">Lorem ipsum dolor.</p>Formato de atributo de tag
attribute (chaves="valor")
┌─────┴────┐
<p lang="pt-BR">Lorem ipsum dolor.</p>Tags sem conteúdos
<meta name="description" content="A description of the page" />Tags sem conteúdos
<meta name="description" content="A description of the page" />Exemplos:
- Global:
lang,id,class - Específico:
<meta>:name,content<img>:src,alt<ol>:start,type<table>:border
Mais exemplos: HTML attribute Reference | MDN
Referência:
Entidades do HTML (Símbolos)
| Caracter | Descrição | Nome | Número |
|---|---|---|---|
| ” | quotation mark | " | " |
| ’ | apostrophe | ' | ' |
| & | ampersand | & | & |
| < | less-than | < | < |
| > | greater-than | > | > |
| © | copyright | © | © |
Referências:
- Named character references | WHATWG (Lista completa)
- Entity | MDN
Estrutura básica
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8" />
<title>Bem-vindos</title>
</head>
<body>
<h1>Olá, turma!</h1>
<p>Meu primeiro parágrafo</p>
</body>
</html>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8" />
<title>Bem-vindos</title>
</head>
<body>
<h1>Olá, turma!</h1>
<p>Meu primeiro parágrafo</p>
</body>
</html>
Tags do HTML
Hyperlink
hyperlink = url + content (text, image…):
Sintaxe Básica
<a href="url">content</a>Sintaxe Básica
<a href="url">content</a>Link externo:
<a href="http://www.ifpb.edu.br/">ifpb</a><a href="http://www.ifpb.edu.br/">ifpb</a>Atributo target:
<a href="http://www.ifpb.edu.br/" target="_blank">ifpb</a><a href="http://www.ifpb.edu.br/" target="_blank">ifpb</a>Link interno:
Estrutura da URL
query
schema domain port path string fragment
┌───┴──┐┌──────┴─────┐┌┴┐┌─────────┴──────────┐┌───┴────┐┌───┴────┐
https://ifpb.github.io:80/dw/html/introduction/?name=ifpb#hyperlinkEstrutura da URL
query
schema domain port path string fragment
┌───┴──┐┌──────┴─────┐┌┴┐┌─────────┴──────────┐┌───┴────┐┌───┴────┐
https://ifpb.github.io:80/dw/html/introduction/?name=ifpb#hyperlink<nav>
<a href="#tags">Tags</a><br />
<a href="#atributo-de-tag">Atributo de tag</a><br />
<a href="#entidade-do-html">Entidade do HTML</a>
</nav>
<h3 id="tags">Tags</h3>
<p>...</p>
<h3 id="atributo-de-tag">Atributo de tag</h3>
<p>...</p>
<h3 id="entidade-do-html">Entidade do HTML</h3>
<p>...</p><nav>
<a href="#tags">Tags</a><br />
<a href="#atributo-de-tag">Atributo de tag</a><br />
<a href="#entidade-do-html">Entidade do HTML</a>
</nav>
<h3 id="tags">Tags</h3>
<p>...</p>
<h3 id="atributo-de-tag">Atributo de tag</h3>
<p>...</p>
<h3 id="entidade-do-html">Entidade do HTML</h3>
<p>...</p>Link entre páginas:
Arquivos
hyperlink-pages
├── index.html
└── pages
└── page.htmlArquivos
hyperlink-pages
├── index.html
└── pages
└── page.html<h1>Index</h1>
<p>
<!-- Endereço relativo (index.html => page.html) -->
<a href="pages/page.html">Index 2 Page</a><br />
<a href="./pages/page.html">Index 2 Page</a><br />
<!-- Endereço absoluto (page.html) -->
<a href="/lm/codes/html/introduction/hyperlink-pages/pages/page.html">
Index 2 Page
</a>
</p><h1>Index</h1>
<p>
<!-- Endereço relativo (index.html => page.html) -->
<a href="pages/page.html">Index 2 Page</a><br />
<a href="./pages/page.html">Index 2 Page</a><br />
<!-- Endereço absoluto (page.html) -->
<a href="/lm/codes/html/introduction/hyperlink-pages/pages/page.html">
Index 2 Page
</a>
</p><h1>Page</h1>
<p>
<!-- Endereço relativo (index.html => page.html) -->
<a href="../index.html">Page 2 Index</a><br />
<!-- Endereço absoluto (index.html) -->
<a href="/lm/codes/html/introduction/hyperlink-pages/index.html">
Page 2 Index
</a>
</p><h1>Page</h1>
<p>
<!-- Endereço relativo (index.html => page.html) -->
<a href="../index.html">Page 2 Index</a><br />
<!-- Endereço absoluto (index.html) -->
<a href="/lm/codes/html/introduction/hyperlink-pages/index.html">
Page 2 Index
</a>
</p>Imagem
Sintaxe
<img src="url" alt="text alternative" />Sintaxe
<img src="url" alt="text alternative" />Arquivos
image
├── imgs
│ └── ifpb-logo.png
└── index.htmlArquivos
image
├── imgs
│ └── ifpb-logo.png
└── index.html<!-- Endereço relativo (index.html => ifpb-logo.png) -->
<img src="imgs/ifpb-logo.png" alt="Logo do IFPB" />
<img src="./imgs/ifpb-logo.png" alt="Logo do IFPB" />
<img src="imgs/none.png" alt="Logo do IFPB" />
<!-- Endereço absoluto (ifpb-logo.png) -->
<img
src="/lm/codes/html/introduction/image/imgs/ifpb-logo.png"
alt="Logo do IFPB"
/><!-- Endereço relativo (index.html => ifpb-logo.png) -->
<img src="imgs/ifpb-logo.png" alt="Logo do IFPB" />
<img src="./imgs/ifpb-logo.png" alt="Logo do IFPB" />
<img src="imgs/none.png" alt="Logo do IFPB" />
<!-- Endereço absoluto (ifpb-logo.png) -->
<img
src="/lm/codes/html/introduction/image/imgs/ifpb-logo.png"
alt="Logo do IFPB"
/>Parent directory:
Arquivos
image-parent
├── imgs
│ └── ifpb-logo.png
└── pages
└── index.htmlArquivos
image-parent
├── imgs
│ └── ifpb-logo.png
└── pages
└── index.html<!-- Endereço relativo (index.html => ifpb-logo.png) -->
<img src="../imgs/ifpb-logo.png" alt="Logo do IFPB" />
<!-- Endereço absoluto (ifpb-logo.png) -->
<img
src="/lm/codes/html/introduction/image-parent/imgs/ifpb-logo.png"
alt="Logo do IFPB"
/><!-- Endereço relativo (index.html => ifpb-logo.png) -->
<img src="../imgs/ifpb-logo.png" alt="Logo do IFPB" />
<!-- Endereço absoluto (ifpb-logo.png) -->
<img
src="/lm/codes/html/introduction/image-parent/imgs/ifpb-logo.png"
alt="Logo do IFPB"
/>Lista
| Tipos | Tags |
|---|---|
| Lista ordenada | <ol>, <li> |
| Lista não ordenada | <ul>, <li> |
| Lista de descrição | <dl>, <dt>, <dd> |
Exemplo:
<!-- Ordered List - OL -->
<h1>Developer Roles</h1>
<ol>
<li>Web developer</li>
<li>Desktop applications developer</li>
<li>Mobile developer</li>
</ol>
<!-- Unordered List - UL -->
<h1>Browser Market Share</h1>
<ul>
<li>Chrome</li>
<li>Safari</li>
<li>Edge</li>
<li>Firefox</li>
</ul>
<p>
Fonte: (<a
href="https://en.wikipedia.org/wiki/Usage_share_of_web_browsers"
>Wikipedia</a
>)
</p>
<!-- Description List - DL -->
<h1>Web Terms</h1>
<dl>
<dt>HTTP</dt>
<dd>HyperText Transfer Protocol</dd>
<dt>URL</dt>
<dd>Uniform Resource Locator</dd>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
<dt>JS</dt>
<dd>JavaScript</dd>
</dl><!-- Ordered List - OL -->
<h1>Developer Roles</h1>
<ol>
<li>Web developer</li>
<li>Desktop applications developer</li>
<li>Mobile developer</li>
</ol>
<!-- Unordered List - UL -->
<h1>Browser Market Share</h1>
<ul>
<li>Chrome</li>
<li>Safari</li>
<li>Edge</li>
<li>Firefox</li>
</ul>
<p>
Fonte: (<a
href="https://en.wikipedia.org/wiki/Usage_share_of_web_browsers"
>Wikipedia</a
>)
</p>
<!-- Description List - DL -->
<h1>Web Terms</h1>
<dl>
<dt>HTTP</dt>
<dd>HyperText Transfer Protocol</dd>
<dt>URL</dt>
<dd>Uniform Resource Locator</dd>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
<dt>JS</dt>
<dd>JavaScript</dd>
</dl>Tabela
Conteúdo Tabular
Linguagem Utilização
Python 14.51%
C 14.41%
Java 13.23%
C++ 12.96%
C# 8.21Conteúdo Tabular
Linguagem Utilização
Python 14.51%
C 14.41%
Java 13.23%
C++ 12.96%
C# 8.21<h1>Table</h1>
<table>
<thead>
<tr>
<th>Linguagem</th>
<th>Utilização</th>
</tr>
</thead>
<tbody>
<tr>
<td>Python</td>
<td>14.51%</td>
</tr>
<tr>
<td>C</td>
<td>14.41%</td>
</tr>
<tr>
<td>Java</td>
<td>13.23%</td>
</tr>
<tr>
<td>C++</td>
<td>12.96%</td>
</tr>
<tr>
<td>C#</td>
<td>8.21%</td>
</tr>
</tbody>
</table><h1>Table</h1>
<table>
<thead>
<tr>
<th>Linguagem</th>
<th>Utilização</th>
</tr>
</thead>
<tbody>
<tr>
<td>Python</td>
<td>14.51%</td>
</tr>
<tr>
<td>C</td>
<td>14.41%</td>
</tr>
<tr>
<td>Java</td>
<td>13.23%</td>
</tr>
<tr>
<td>C++</td>
<td>12.96%</td>
</tr>
<tr>
<td>C#</td>
<td>8.21%</td>
</tr>
</tbody>
</table>