<button onclick="adicionarAoCarrinho('Honda CRF 250', 75000)">Adicionar no carrinho</button>
java
Tipo: Outro
codigo jaja
<script>
function adicionarAoCarrinho(nome, preco) {
// 1. Busca o que já existe no carrinho (se não existir, cria uma lista vazia)
let carrinho = JSON.parse(localStorage.getItem('meuCarrinho')) || [];
// 2. Adiciona a nova moto na lista
carrinho.push({ nome: nome, preco: preco });
// 3. Salva a lista atualizada de volta no navegador
localStorage.setItem('meuCarrinho', JSON.stringify(carrinho));
alert(nome + " foi adicionada ao carrinho!");
}
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head>
<title>Posicionamento com CSS</title>
<link rel="stylesheet" href="colocar css" type="text/css">
</head>
<body>
<div class=" ">
<p>Esquerda em Cima</p>
</div>
<div class=" ">
<p>Esquerda em Baixo</p>
</div>
<div class=" ">
<p>Direita em Cima</p>
</div>
<div class=" ">
<p>Direita em Baixo</p>
</div>
</body>
posicionamento de texto
Tipo: CSS
auxiliar na aula de 06/03
body {
margin: 0;
height: 100vh; /* ocupa toda a altura da tela */
position: relative;
font-family: Arial, sans-serif;
}
div {
width: 200px;
height: 100px;
background-color: lightblue;
border: 2px solid #333;
text-align: center;
line-height: 100px;
font-weight: bold;
position: absolute;
}
/* Esquerda em cima */
.esqcima {
top: 0;
left: 0;
}
/* Esquerda em baixo */
.esqbaixo {
bottom: 0;
left: 0;
}
/* Direita em cima */
.dircima {
top: 0;
right: 0;
}
/* Direita em baixo */
.dirbaixo {
bottom: 0;
right: 0;
}
CSS de textos
Tipo: Formulário
aaaa
Aqui está um exemplo completo dos códigos para posicionar os quatro blocos (esquerda em cima, esquerda em baixo, direita em cima e direita em baixo) usando **HTML** e **CSS**.
### 📄 Arquivo `index2.html`
```html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Posicionamento com CSS</title>
<link rel="stylesheet" href="posicionamento.css" type="text/css">
</head>
<body>
<div class="esqcima">
<p>Esquerda em Cima</p>
</div>
<div class="esqbaixo">
<p>Esquerda em Baixo</p>
</div>
<div class="dircima">
<p>Direita em Cima</p>
</div>
<div class="dirbaixo">
<p>Direita em Baixo</p>
</div>
</body>
</html>
```
### 🎨 Arquivo `posicionamento.css`
```css
body {
margin: 0;
height: 100vh; /* ocupa toda a altura da tela */
position: relative;
font-family: Arial, sans-serif;
}
div {
width: 200px;
height: 100px;
background-color: lightblue;
border: 2px solid #333;
text-align: center;
line-height: 100px;
font-weight: bold;
position: absolute;
}
/* Esquerda em cima */
.esqcima {
top: 0;
left: 0;
}
/* Esquerda em baixo */
.esqbaixo {
bottom: 0;
left: 0;
}
/* Direita em cima */
.dircima {
top: 0;
right: 0;
}
/* Direita em baixo */
.dirbaixo {
bottom: 0;
right: 0;
}
```
👉 Com esse código, cada bloco ficará fixado em um dos cantos da tela, exatamente como descrito.
Você gostaria que eu te mostrasse também uma versão alternativa usando **Flexbox** ou **Grid**, que são formas mais modernas e flexíveis de posicionar elementos?
aula 02/03/2026
Tipo: Layout
Aula
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Projeto Estrutura HTML</title>
<style>
/* ===== RESET BÁSICO ===== */
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body{
font-family: Arial, Helvetica, sans-serif;
background-color: #f4f6f9;
}
header{
background-color: #1e3a8a;
color: white;
text-align: center;
padding: 20px;
}
nav{
background-color: #3b82f6;
padding: 10px;
text-align: center;
}
nav a{
color: white;
text-decoration: none;
margin: 0 15px;
font-weight: bold;
}
section{
padding: 20px;
margin: 20px;
background-color: white;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
footer{
background-color: #1e3a8a;
color: white;
text-align: center;
padding: 15px;
margin-top: 20px;
}
.area-exercicio{
border: 2px dashed #999;
padding: 20px;
margin-top: 15px;
background-color: #f9fafb;
}
</style>
</head>
<body>
<!-- ===== CABEÇALHO ===== -->
<header>
<h1>Projeto de Estrutura HTML</h1>
<h2>Atividade de Inserção de Elementos</h2>
<p>Complete os espaços indicados pelo professor.</p>
</header>
<!-- ===== MENU ===== -->
<nav>
<a href="#">Home</a>
<a href="#">Sobre</a>
<a href="#">Contato</a>
</nav>
<!-- ===== SEÇÃO DE IMAGENS ===== -->
<section>
<h2>Área de Imagens</h2>
<p>Os alunos devem inserir 4 tipos diferentes de imagens abaixo:</p>
<div class="area-exercicio">
<!-- INSERIR AQUI:
1 - Imagem simples
2 - Imagem com width e height
3 - Imagem com link
4 - Imagem com borda personalizada
-->
</div>
</section>
<!-- ===== SEÇÃO DE BOTÕES ===== -->
<section>
<h2>Área de Botões</h2>
<p>Os alunos devem inserir 4 tipos diferentes de botões:</p>
<div class="area-exercicio">
<!-- INSERIR AQUI:
1 - Botão simples
2 - Botão com cor personalizada
3 - Botão com link
4 - Botão com efeito hover
-->
</div>
</section>
<!-- ===== SEÇÃO DE LISTAS ===== -->
<section>
<h2>Área de Listas</h2>
<p>Os alunos devem inserir 2 tipos de listas:</p>
<div class="area-exercicio">
<!-- INSERIR AQUI:
1 - Lista não ordenada (ul)
2 - Lista ordenada (ol)
-->
</div>
</section>
<!-- ===== SEÇÃO DE TABELAS ===== -->
<section>
<h2>Área de Tabelas</h2>
<p>Os alunos devem inserir 2 tabelas diferentes:</p>
<div class="area-exercicio">
<!-- INSERIR AQUI:
1 - Tabela simples (3 colunas)
2 - Tabela com thead e tbody
-->
</div>
</section>
<!-- ===== RODAPÉ ===== -->
<footer>
<p>Atividade de HTML - Desenvolva sua estrutura corretamente.</p>
</footer>
</body>
</html>
Código mais fácil
Tipo: Layout
Mais fácil
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>Meu Diário</title>
<style>
/* ===== ESTILO GERAL ===== */
body {
font-family: Arial, sans-serif;
background-color: #f4f6fb;
margin: 0;
padding: 0;
}
/* ===== CONTAINER PRINCIPAL ===== */
.container {
width: 80%;
max-width: 800px;
margin: 40px auto;
background-color: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0px 4px 10px rgba(0,0,0,0.1);
}
/* ===== TÍTULO PRINCIPAL ===== */
h1 {
text-align: center;
color: #5a4fcf;
}
/* ===== SUBTÍTULOS ===== */
h2 {
color: #333;
border-bottom: 2px solid #5a4fcf;
padding-bottom: 5px;
}
/* ===== PARÁGRAFOS ===== */
p {
color: #555;
line-height: 1.6;
}
/* ===== IMAGENS ===== */
img {
width: 100%;
max-height: 300px;
object-fit: cover;
border-radius: 8px;
margin-top: 10px;
}
/* ===== BOTÕES ===== */
button {
background-color: #5a4fcf;
color: white;
border: none;
padding: 10px 20px;
margin-top: 10px;
border-radius: 6px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #483db0;
}
</style>
</head>
<body>
<div class="container">
<!-- TÍTULO PRINCIPAL -->
<h1>📖 Meu Diário</h1>
<!-- SOBRE MIM -->
<h2>Sobre mim</h2>
<p>
Este é o meu diário pessoal. Aqui eu escrevo sobre meus dias,
meus sentimentos, meus sonhos e momentos importantes da minha vida.
</p>
<!-- LOCAL PARA IMAGEM DE PERFIL -->
<!-- Coloque aqui sua imagem -->
<!-- Exemplo:
<img src="minha-foto.jpg" alt="Minha foto">
-->
<!-- REGISTRO DO DIA -->
<h2>Registro do Dia</h2>
<p>
Hoje foi um dia muito especial. Aconteceram várias coisas interessantes
que quero guardar como lembrança.
</p>
<!-- LOCAL PARA IMAGEM DO DIA -->
<!-- Exemplo:
<img src="foto-do-dia.jpg" alt="Foto do dia">
-->
<!-- OBJETIVOS -->
<h2>Meus Objetivos</h2>
<p>
Meus objetivos para os próximos dias são estudar mais,
organizar minha rotina e continuar aprendendo coisas novas.
</p>
<!-- LOCAL PARA BOTÕES -->
<button>Adicionar Novo Registro</button>
<button>Salvar Diário</button>
</div>
</body>
</html>
abela com 30 Fontes para Usar no HTML
Nº
Nome da Fonte
Exemplo de Uso no HTML
1
Arial
style="font-family: Arial;"
2
Verdana
style="font-family: Verdana;"
3
Tahoma
style="font-family: Tahoma;"
4
Trebuchet MS
style="font-family: 'Trebuchet MS';"
5
Times New Roman
style="font-family: 'Times New Roman';"
6
Georgia
style="font-family: Georgia;"
7
Garamond
style="font-family: Garamond;"
8
Courier New
style="font-family: 'Courier New';"
9
Lucida Console
style="font-family: 'Lucida Console';"
10
Monaco
style="font-family: Monaco;"
11
Impact
style="font-family: Impact;"
12
Comic Sans MS
style="font-family: 'Comic Sans MS';"
13
Palatino Linotype
style="font-family: 'Palatino Linotype';"
14
Segoe UI
style="font-family: 'Segoe UI';"
15
Century Gothic
style="font-family: 'Century Gothic';"
16
Calibri
style="font-family: Calibri;"
17
Candara
style="font-family: Candara;"
18
Franklin Gothic Medium
style="font-family: 'Franklin Gothic Medium';"
19
Gill Sans
style="font-family: 'Gill Sans';"
20
Optima
style="font-family: Optima;"
21
Perpetua
style="font-family: Perpetua;"
22
Book Antiqua
style="font-family: 'Book Antiqua';"
23
Consolas
style="font-family: Consolas;"
24
MS Serif
style="font-family: 'MS Serif';"
25
MS Sans Serif
style="font-family: 'MS Sans Serif';"
26
Brush Script MT
style="font-family: 'Brush Script MT';"
27
Rockwell
style="font-family: Rockwell;"
28
Baskerville
style="font-family: Baskerville;"
29
Courier
style="font-family: Courier;"
30
Futura
style="font-family: Futura;"
Salvar Dados da Tabela (Exibir em Alerta)
Tipo: Outro
Função: Coleta os dados da tabela e exibe em uma janela de alerta.
Uso comum: Pré-visualização de informações antes de enviar ou salvar.
function salvarTabela() {
let tabela = document.getElementById("minhaTabela");
let dados = "";
for (let i = 1; i < tabela.rows.length; i++) {
let produto = tabela.rows[i].cells[0].innerText;
let preco = tabela.rows[i].cells[1].innerText;
dados += `Produto: ${produto}, Preço: ${preco}\n`;
}
alert("Dados da Tabela:\n" + dados);
}
Remover Última Linha com Botão
Tipo: Outro
Função: Remove a última linha da tabela, evitando apagar o cabeçalho.
Uso comum: Ajustes em tempo real, exclusão de itens.
function removerLinha() {
let tabela = document.getElementById("minhaTabela");
if (tabela.rows.length > 1) {
tabela.deleteRow(-1);
}
}
Adicionar Nova Linha com Botão
Tipo: Outro
Função: Insere uma nova linha editável na tabela ao clicar no botão.
Uso comum: Listas de compras, pedidos, cadastros dinâmicos.
function adicionarLinha() {
let tabela = document.getElementById("minhaTabela");
let novaLinha = tabela.insertRow();
let celula1 = novaLinha.insertCell(0);
let celula2 = novaLinha.insertCell(1);
celula1.contentEditable = true;
celula2.contentEditable = true;
celula1.innerText = "Novo Produto";
celula2.innerText = "0.00";
}
Tabela HTML Editável
Tipo: Outro
Função: Permite que o usuário edite diretamente o conteúdo das células no navegador.
Uso comum: Formulários dinâmicos, planilhas simples, protótipos interativos.
<td contenteditable="true">Maria</td>
Mover Texto com Margens Laterais
Tipo: Outro
Função: Posiciona o texto com espaçamento lateral.
Uso comum: Ajustes finos em layout, destaque de blocos específicos.
Esse código cria uma lista com marcadores, usada para listar itens sem ordem específica.
Tag usada: <ul> (unordered list)
Cada item: <li> representa um ingrediente ou elemento
Exemplo de uso: Lista de compras, ingredientes, tópicos
Visual: Os itens aparecem com bolinhas ou outros marcadores
<ul>
<li>3 cenouras médias</li>
<li>4 ovos</li>
<li>1 xícara de óleo</li>
<li>2 xícaras de açúcar</li>
</ul>
Lista ordenada
Tipo: Texto
Esse código cria uma lista numerada, ideal para instruções passo a passo, como receitas ou tutoriais.
Tag usada: <ol> (ordered list)
Cada item: <li> representa uma etapa
Exemplo de uso: Receita de bolo, instruções de montagem, guia de tarefas
Visual: Os itens aparecem com números (1, 2, 3...)
<ol>
<li>Preaqueça o forno a 180°C.</li>
<li>Bata os ingredientes no liquidificador.</li>
<li>Despeje em uma forma untada.</li>
<li>Asse por 40 minutos.</li>
</ol>