Desenvolvimento web com html css e javascript

Page 206

CSS

194

2 width : 50%; 3 }

Podemos utilizar as propriedades de margem para alinhar de forma centralizada na horizontal o div2. 1 # div2 { 2 margin - left : auto ; 3 margin - right : auto ; 4 width : 50%; 5 }

Exercícios de Fixação

No projeto css, crie um arquivo chamado margens.html.

27

1 <! DOCTYPE html > 2 < html lang = " pt - br " > 3 < head > 4 < meta http - equiv = " Content - Type " content = " text / html ; charset = UTF -8 " > 5 < title > K19 - Margens </ title > 6 < link rel = " stylesheet " type = " text / css " href = " margens . css " > 7 </ head > 8 < body > 9 < div > 10 <p id = " p1 " > K19 </ p > 11 <a id = " a1 " href = " # " > k19 </ a > 12 <a id = " a2 " href = " # " > k19 </ a > 13 <p id = " p2 " > K19 </ p > 14 </ div > 15 </ body > 16 </ html > Código HTML 3.17: margens.html

Arquivo: https://github.com/K19/K19-Exercicios/archive/k02-css-fixacao27.zip

No projeto css, crie um arquivo CSS chamado margens.css.

28

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

div { width : 600 px ; border : 1 px solid black ; } p, a { border : 1 px solid black ; } # p1 { margin : 5 px 10 px 20 px 30 px ; padding : 5 px 0 px 0 px 20 px ; } # a1 { margin - left : 10 px ;

194

www.k19.com.br


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.