Escolar Documentos
Profissional Documentos
Cultura Documentos
Programação de Servidores
http://marx.vanderlinden.com.br/ 2
Introdução
http://marx.vanderlinden.com.br/ 3
CSS - Cascading Style Sheet
http://marx.vanderlinden.com.br/ 4
CSS - Cascading Style Sheet
http://marx.vanderlinden.com.br/ 5
CSS - Histórico
http://marx.vanderlinden.com.br/ 6
Proposta
http://marx.vanderlinden.com.br/ 7
Proposta
Separação de Responsabilidades
http://marx.vanderlinden.com.br/ 9
Tipos
Interno:
Página
Externo:
http://marx.vanderlinden.com.br/ 10
Tipos
INTERNO
LOCAL
EXTERNO
http://marx.vanderlinden.com.br/ 11
Estrutura
http://marx.vanderlinden.com.br/ 12
Folhas de Estilo
Anatomia de um Estilo
Estilos são definidos através de propriedades
Seletor
H1 {
font-size: 12pt;
color: red
}
http://marx.vanderlinden.com.br/ 13
Folhas de Estilo Locais
<H1 STYLE="color:green">
Esse é um texto verde!
</H1>
http://marx.vanderlinden.com.br/ 14
Folhas Internas
<HTML>
<HEAD>
<TITLE> ::: ATÉ QUE ENFIM SAÍMOS DE
HTML... ::: </TITLE>
<STYLE>
H1 {size:12;color:red}
P {text-align: justify; font:
10pt,"Verdana"}
</STYLE>
</HEAD>
<body>
<H1> Folhas de Estilo </H1>
<P> Texto do parágrafo. </P>
</body> http://marx.vanderlinden.com.br/ 15
</html>
Folhas Internas
Folhas de Estilo
Texto do parágrafo.
http://marx.vanderlinden.com.br/ 16
Folhas Internas
(fatoração)
As definições aplicam-se a vários trechos
da página repetidamente
Se precisar aplicar os mesmos estilos a
http://marx.vanderlinden.com.br/ 17
Folhas Internas
Observações
Podem-se definir propriedades para várias
http://marx.vanderlinden.com.br/ 18
Folhas Externas
arquivo de estilos
Fatoração deve ocorrer em todo o site
http://marx.vanderlinden.com.br/ 19
Folhas Externas
definição.css
Fonte azul
Fonte Verde
Fonte Vermelha
<body> <body>
aaaaaaaaaaaaa cccccccccccccc
bbbbbbbbbbbbb dddddddddddd
</body> </body>
http://marx.vanderlinden.com.br/ 20
Folhas Externas
Digite os pares
http://marx.vanderlinden.com.br/ 21
Folhas Externas
o estilo:
Na seção HEAD digite:
http://marx.vanderlinden.com.br/ 22
Classes de Estilos
normais
Aplicável apenas à Folhas Internas ou
Externas
http://marx.vanderlinden.com.br/ 23
Classes de Estilos
SELETOR.nomedaclasse
{ propriedade:valor }
<SELETOR CLASS="nomedaclasse">
http://marx.vanderlinden.com.br/ 24
Classes de Estilos
<HTML>
<HEAD><TITLE> ::: CSS ::: </TITLE>
<STYLE>
P { COLOR:RED }
P.DIFERENTE { COLOR:BLUE }
</STYLE>
</HEAD>
<BODY>
<P> Isso é um parágrafo comum!!!! </P>
<P CLASS=“DIFERENTE”>
Parágrafo diferente! </P>
</BODY>
</HTML> http://marx.vanderlinden.com.br/ 25
Classes de Estilos
<HTML>
<HEAD><TITLE> ::: CSS ::: </TITLE>
<STYLE>
P.JOAO { FONT: BOLD; COLOR:RED }
P.MARIA { COLOR:BLUE }
</STYLE>
</HEAD>
<BODY>
<P CLASS=“JOAO”> “ONDE ESTIVESTES,
MARIA?” </P>
<P CLASS=“MARIA”> “NÃO É DE SUA
CONTA!” </P>
<P CLASS=“JOAO”> “CLARO QUE É! POIS
SOU TEU PAI!” </P>
</BODY> http://marx.vanderlinden.com.br/ 26
</HTML>
http://marx.vanderlinden.com.br/ 27
Herança
http://marx.vanderlinden.com.br/ 28
Herança
http://marx.vanderlinden.com.br/ 29
Classes de Estilos
H1 EM { color:red }
Inclinação
Altura da linha
http://marx.vanderlinden.com.br/ 31
Formatando Texto com Estilo
Fontes
São os elementos básicos de um
documento.
São estilos de apresentação que se aplicam
Tamanho
Sintaxe:
font-family: fonte1, fonte2; fonte3...
H1 {font-family: garamond}
H2 {font-family: arial, helvetica,
sans-serif}
H3 {font-family: "TIMES NEW ROMAN"}
http://marx.vanderlinden.com.br/ 33
Famílias Genéricas
IE7/Windows Safari/Mac
http://marx.vanderlinden.com.br/ 34
Formatando Texto com Estilo
Tamanho da fonte
Propriedade font-size
Valores atribuídos são absolutos ou relativos
Estilo
font-style define a inclinação da fonte.
font-style:normal
font-style: italic
H1{font-style: normal}
H3{font-style: italic}
http://marx.vanderlinden.com.br/ 36
Formatando Texto com Estilo
Peso
font-weight define o peso ou largura da
fonte
•font-weight: bold
•font-weight: bolder
•font-weight: light
•Font-weight: lighter
•Font-weight: 100 | 200 | 300 | 400 |
500 | 600 | 700 | 800 |900
http://marx.vanderlinden.com.br/ 37
Implementação dos pesos
bold 100
bolder 200
light 300
lighter 400
500
600
700
800
900
http://marx.vanderlinden.com.br/ 38
Cores
Padrão RGB
#000000 #000066 #000099 #0000FF
http://marx.vanderlinden.com.br/ 39
Padrão RGB
#A0522D
Red: A0 → 160
Green: 52 → 82
Blue: 2D → 45
Padrão Nominal
http://marx.vanderlinden.com.br/ 41
Formatando Texto com Estilo
Cor de Texto
color : nome
color : #RRGGBB
H1 { color : gray }
P { color : #FFFFFF }
http://marx.vanderlinden.com.br/ 42
Formatando Texto com Estilo
Cor de Texto
color : rgb(R,G,B)
Valores entre 0 e 255
color : rgb(R%,G%,B%)
Valores entre 0 e 100
http://marx.vanderlinden.com.br/ 43
Formatando Texto com Estilo
<html>
<head><title> ::: Página Exemplo... :::
</title>
<style>
P { color:rgb(70,20,255); }
H1 {color:rgb(30%,50%,10%)}
</style>
</head>
<body>
<H1> Título da Página </H1>
<P> Um parágrafo começa aqui. </P>
</body>
</html>
http://marx.vanderlinden.com.br/ 44
Formatando Texto com Estilo
http://marx.vanderlinden.com.br/ 45
Formatando Texto com Estilo
FONT
Permite especificar várias propriedades de
uma só vez
font: font-style, font-weight, font-size, font-
family
H1 {font: italic 24pt "sans serif"}
http://marx.vanderlinden.com.br/ 46
Formatando Texto com Estilo
Plano de fundo
background-color : transparent
background-color : cor
background-color : #rrggbb
background-image : url (caminho da imagem)
http://marx.vanderlinden.com.br/ 47
Formatando Texto com Estilo
Exemplos:
H1 { background-color : transparent;
color:black }
H3{ background-image:
url(file:///c:/imagens/sol.jpg) }
http://marx.vanderlinden.com.br/ 48
Formatando Texto com Estilo
H1
H2
http://marx.vanderlinden.com.br/ 49
Formatando Texto com Estilo
Espaçamento
Entre palavras (tracking)
margem.
text-ident : valor absoluto
text-ident : porcentagem
http://marx.vanderlinden.com.br/ 51
Formatando Texto com Estilo
http://marx.vanderlinden.com.br/ 53
Formatando Texto com Estilo
Alinhamento
Define a posição do texto na página
text-align:left
text-align:right
text-align:center
text-align:justify
http://marx.vanderlinden.com.br/ 54
Formatando Texto com Estilo
http://marx.vanderlinden.com.br/ 55
Formatando Texto com Estilo
Uso de Linhas
Permite destacar um determinado texto
text-decoration:overline
text-decoration:line-through
http://marx.vanderlinden.com.br/ 56
Formatando Texto com Estilo
<html><head>
<title>Untitled Document</title>
<style>
p.sublinhado {text-decoration:underline}
p.porcima{text-decoration:overline}
p.riscado {text-decoration:line-through}
</style>
</head><body>
<p class="sublinhado"> Esse texto
está sublinhado </p>
<p class="porcima"> Esse texto
está sobrelinhado </p>
<p class="riscado"> Esse texto
está riscado </p>
http://marx.vanderlinden.com.br/ 57
</body></html>
Formatando Texto com Estilo
http://marx.vanderlinden.com.br/ 58
Formatando Texto com Estilo
http://marx.vanderlinden.com.br/ 59
Formatando Texto com Estilo
Mudando o estado
Maiúscula / Minúscula
text-transform: capitalize
text-transform: uppercase
text-transform: lowercase
text-transform: none
a:hover {text-transform:uppercase;}
http://marx.vanderlinden.com.br/ 61
Cor de Fundo
Sintaxe:
background-color: transparent
background-color: nome-da-cor
background-color: #hexadecimal
azul)
http://marx.vanderlinden.com.br/ 62
Cor de Fundo
Exemplos
H1 { background-color: yellow }
P { background-color: #AA00FF }
http://marx.vanderlinden.com.br/ 63
Imagem de Fundo
Sintaxe:
background-image: none
Observação
arquivo quehttp://marx.vanderlinden.com.br/
contém a folha de estilo. 64
Imagem de Fundo
Exemplos
H1 { background-image: url
(http://www.bla.com/img/a.gif) }
http://marx.vanderlinden.com.br/ 65
Imagem de Fundo
background-repeat: repeat-x
background-repeat: repeat-y
background-repeat: no-repeat
http://marx.vanderlinden.com.br/ 66
Imagem de Fundo
Exemplos
http://marx.vanderlinden.com.br/ 67
Imagem de Fundo
background-attachment: fixed
background-attachment: scroll
http://marx.vanderlinden.com.br/ 68
Imagem de Fundo
Exemplos
http://marx.vanderlinden.com.br/ 69
Plano de Fundo
background: background-color
background-image background-repeat
background-attachment background-
position
http://marx.vanderlinden.com.br/ 70
Plano de Fundo
Exemplos
http://marx.vanderlinden.com.br/ 71