Exercícios Módulo Iniciando Com o CSS
Exercícios Módulo Iniciando Com o CSS
5. Letter spacing
6. Manipulando dimensões
9. Limitando as dimensões
1. Crie uma imagem e limite sua largura para 300px e altura para 200px usando CSS.
2. Use a propriedade max-width para evitar que a imagem ultrapasse 90% da largura
da tela.
1. Crie um bloco <div> com conteúdo maior que seu tamanho (ex: 200px x 200px).
2. Use as seguintes propriedades de overflow e observe o comportamento:
○ overflow: hidden;
○ overflow: scroll;
○ overflow: auto;
ATENÇÃO - NA PRÓXIMA PÁGINA
IREMOS APRESENTAR A RESOLUÇÃO
DOS EXERCÍCIOS.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>CSS Básico</title>
<style>
body {
background-color: lightblue;
color: white;
}
p {
border: 2px solid black;
}
</style>
</head>
<body>
<p>Este é um parágrafo com borda.</p>
</body>
</html>
2. Estilos externos, IDs e classes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>IDs e Classes</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1 id="header">Título Principal</h1>
<p class="destaque">Parágrafo destacado.</p>
<p>Parágrafo comum.</p>
</body>
</html>
#header {
background-color: green;
color: white;
}
.destaque {
color: yellow;
font-weight: bold;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Menu Básico</title>
<link rel="stylesheet" href="menu.css">
</head>
<body>
<ul class="menu">
<li>Home</li>
<li>Sobre</li>
<li>Serviços</li>
<li>Contato</li>
</ul>
</body>
</html>
.menu {
list-style: none;
display: flex;
gap: 20px;
padding: 0;
}
.menu li {
padding: 10px 20px;
background-color: #007bff;
color: white;
cursor: pointer;
}
.menu li:hover {
background-color: #0056b3;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Estilizando Texto</title>
<style>
p {
font-family: Arial, sans-serif;
font-size: 20px;
text-align: justify;
color: gray;
}
</style>
</head>
<body>
<p>Texto estilizado com CSS.</p>
</body>
</html>
5. Letter spacing
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Letter Spacing</title>
<style>
h2 {
letter-spacing: 2px;
}
h2:hover {
letter-spacing: 5px;
}
</style>
</head>
<body>
<h2>CSS é incrível</h2>
</body>
</html>
6. Manipulando dimensões
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Dimensões</title>
<style>
.box {
width: 50%;
height: 300px;
border: 2px solid black;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Listas</title>
<style>
ol {
color: red;
margin: 10px;
}
</style>
</head>
<body>
<ol>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Classes</title>
<style>
.botao {
background-color: blue;
color: white;
border-radius: 5px;
padding: 10px 20px;
}
</style>
</head>
<body>
<button class="botao">Enviar</button>
<button class="botao">Cancelar</button>
<button class="botao">Voltar</button>
</body>
</html>
9. Limitando dimensões
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Dimensões</title>
<style>
img {
max-width: 300px;
height: auto;
}
</style>
</head>
<body>
<img src="exemplo.jpg" alt="Exemplo">
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Espaçamentos</title>
<style>
.box {
margin: 20px;
padding: 15px;
border: 1px solid black;
}
</style>
</head>
<body>
<div class="box">Texto com espaçamento.</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Display</title>
<style>
.container {
display: flex;
justify-content: center;
gap: 10px;
}
.box {
width: 100px;
height: 100px;
background-color: blue;
}
</style>
</head>
<body>
<div class="container">
<div class="box"></div>
<div class="box"></div>
</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Float</title>
<style>
.box {
float: left;
width: 100px;
height: 100px;
background-color: red;
margin: 10px;
}
.clear {
clear: both;
}
</style>
</head>
<body>
<div class="box"></div>
<div class="box"></div>
<div class="clear"></div>
<footer>Rodapé</footer>
</body>
</html>
13. Overflow
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial-scale=1.0">
<title>Overflow</title>
<style>
.box {
width: 200px;
height: 200px;
overflow: auto;
border: 1px solid black;
}
</style>
</head>
<body>
<div class="box">
<p>Texto muito longo que ultrapassa o tamanho do box...</p>
</div>
</body>
</html>