Html Básico Estilo
()
ESTILOS HTML
O atributo style é usado para estilizar elementos HTML.
Tente você mesmo: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_styles
_______________________________________________________________________________
O ATRIBUTO STYLE
O propósito do atributo style é:
Promover uma forma comum de estilizar todos os elementos HTML.
O atributo foi introduzido com a versão HTML 4, como a nova e preferida forma de estilizar elementos HTML. O estilo pode ser adicionado ao elemento HTML diretamente utilizando o atributo style, ou indiretamente utilizando Style Sheets (Lista de Estilos - aprenda Cascade Style Sheets).
Você pode aprender tudo sobre styles e Cascade Style Sheets no curso de CSS.
Neste curso de HTML vamos utilizar o atributo style como introdução aos estilos em HTML.
_______________________________________________________________________________
TAGS E ATRIBUTOS OBSOLETOS
Em HTML 4, muitas tags e atributos se tornaram obsoletos, e não serão suportados em versões futuras.
Atenção: evite utilizar tags e atributos obsoletos para evitar problemas futuros no seu site.
Estes tags e atributos devem ser evitados:
TAG DESCRIÇÃO
<center> Define conteúdo centralizado.
<font>; <basefont> Define a fonte das letras do texto.
<s>;<strike> Define texto tachado.
<u> Define texto sublinhado.
ATRIBUTO DESCRIÇÃO
align Define o alinhamento do texto.
bgcolor Define a cor de fundo da tela.
color Define a cor do texto.
_______________________________________________________________________________
EXEMPLO ESTILO HTML - COR DE FUNDO
A propriedade background-color defne a cor de fundo de um elemento:
Exemplo:
<html>
<body style="background-color:yellow">
<h2 style="background-color:red">This is a heading</h2>
<p style="background-color:green">This is a paragraph.</p>
</body>
</html>
Teste você mesmo: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_bodybgstyle
O atributo style torna o antigo atributo bgcolor obsoleto.
Tente do modo antigo: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_bodybgcol
_______________________________________________________________________________
EXEMPLO ESTILO HTML - FONTE, COR E TAMANHO
Os atributos font-family, color e font-size definem respectivamente a fonte, a cor e o tamanho das letras de um elemento:
Exemplo:
<html>
<body>
<h1 style="font-family:verdana">A heading</h1>
<p style="font-family:arial;color:red;font-size:20px;">A paragraph.</p>
</body>
</html>
Teste você mesmo: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_newfont
O atributo style torna a tag <font> obsoleta.
Tente da forma antiga: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_font
_______________________________________________________________________________
EXEMPLO DE ESTILO HTML - ALINHAMENTO DE TEXTOS
A propriedade text-align define o alinhamento horizontal do texto de um elemento.
Exemplo:
<html>
<body>
<h1 style="text-align:center">This is a heading</h1>
<p>The heading above is aligned to the center of this page.</p>
</body>
</html>
Teste você mesmo: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_headeralign
O atributo style torna o antigo atributo "align" obsoleto.
Tente da forma antiga: http://www.w3schools.com/html/tryit.asp?filename=tryhtml_header
Resumos Relacionados
- Html Básico - Tabelas
- Html Básico Formatação
- Html Básico Atributos
- Html Básico - Imagens
- Html Básico - Listas
|
|