> For the complete documentation index, see [llms.txt](https://favelaware.gitbook.io/favelaware/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://favelaware.gitbook.io/favelaware/4-html/4.5-links-e-formularios.md).

# 4.5 Links e formulários

### 📘 Introdução ao HTML: Links e Formulários

Os **links** e **formulários** são partes fundamentais da navegação e da interação com páginas na web. Os **links** conectam páginas e conteúdos; os **formulários** permitem a coleta de informações do usuário.

***

#### 🔗 LINKS – A Tag `<a>`

A tag `<a>` é usada para criar **hiperligações** (links) que levam o usuário para outra página, documento ou até para uma parte específica da mesma página.

**📌 Sintaxe básica:**

```html
<a href="https://www.exemplo.com">Visite nosso site</a>
```

| Atributo | Função                                                     |
| -------- | ---------------------------------------------------------- |
| `href`   | Define o endereço (URL ou caminho) para onde o link aponta |
| `target` | Define onde o link será aberto (ex: nova aba)              |

**🔧 Exemplos úteis:**

* **Abrir em nova aba:**

```html
<a href="https://google.com" target="_blank">Abrir Google</a>
```

* **Link interno (página local):**

```html
<a href="contato.html">Página de Contato</a>
```

* **Link para âncora (dentro da mesma página):**

```html
<a href="#topo">Voltar ao topo</a>
```

***

#### 📝 FORMULÁRIOS – A Tag `<form>`

O formulário permite que o usuário **insira dados** em campos interativos. Ele usa a tag `<form>` como contêiner principal e campos como `<input>`, `<textarea>`, `<select>`, etc.

**📌 Estrutura básica:**

```html
<form action="/enviar.php" method="post">
  <label for="nome">Nome:</label>
  <input type="text" id="nome" name="nome">
  <input type="submit" value="Enviar">
</form>
```

| Atributo | Função                                                     |
| -------- | ---------------------------------------------------------- |
| `action` | URL para onde os dados serão enviados                      |
| `method` | Método de envio: `get` (visível na URL) ou `post` (oculto) |

***

#### ✏️ Campos Comuns em Formulários

| Campo            | Tag                       | Exemplo                  |
| ---------------- | ------------------------- | ------------------------ |
| Texto curto      | `<input type="text">`     | Nome, e-mail             |
| Senha            | `<input type="password">` | Campo oculto             |
| Caixa de texto   | `<textarea>`              | Comentários              |
| Botão de envio   | `<input type="submit">`   | Enviar dados             |
| Caixa de seleção | `<input type="checkbox">` | Aceitar termos           |
| Botão de opção   | `<input type="radio">`    | Gênero, opções únicas    |
| Lista suspensa   | `<select>` + `<option>`   | Escolher país, categoria |

**📌 Exemplo com vários campos:**

```html
<form>
  <label for="email">E-mail:</label>
  <input type="email" id="email" name="email"><br><br>

  <label for="mensagem">Mensagem:</label><br>
  <textarea id="mensagem" name="mensagem"></textarea><br><br>

  <input type="submit" value="Enviar">
</form>

```

#### ✅ Conclusão

* A tag `<a>` cria links e pode apontar para outras páginas, arquivos, âncoras ou URLs externas.
* A tag `<form>` permite a **interação do usuário**, capturando dados com diversos campos como `input`, `textarea`, `select`, entre outros.

Esses elementos formam a base da navegação e da comunicação com servidores em páginas web.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://favelaware.gitbook.io/favelaware/4-html/4.5-links-e-formularios.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
