Documente Academic
Documente Profesional
Documente Cultură
pag. 1
foi de stil n
Stilurile vin n ajutorul designerilor de pagini web prin completarea codului XHTML. Astfel dac n HTML prin <b> specific m doar ca un text s fie ngro at, prin CSS putem modifica chiar i dimensiunea fontului, culoarea, fundalul etc. Astfel putem spune c stilurile sunt modific ri ale propriet ilor elementelor HTML. Pentru a defini o regul CSS s facem compara ie cu XHTML: valori
atribute
valori
REGULA CSS
Mai simplu am putea defini o regula CSS astfel: selector { proprietate: valoare; }
pag. 2
n fi ierul HTML, n zona <head> se adaug o leg tur c tre fi ierul css ce con ine regulile. <html><head> <link rel=stylesheet type=text/css href=main.css media=all /> </head> 1.4 CA FI IER IMPORTAT n fi ierul HTML, n zona <head> se import fi ierul css ce con ine regulile. <html><head> <style type=text/css> @import url(main.css); </style> </head> Aten ie, aceste patru modele se pot combina. Astfel ntr-un fi ier HTML putem avea dou fi ier legate cu LINK i cteva reguli de tip EMBEDED.
Selectorii te tip ID sunt unici, adic , putem avea sa zicem un singur id first ntr-un document. Ex: <div id=top> ............. </div> Acest ID va primi regula sub forma #top { width:200px; border: 1px solid green; } Selectorii de tip clas se folosesc pentru a specifica mai multe etichete HTML c rora li se aplic o regul .
pag. 3
.def b {color: red; } --> se aplic etichetei <b> din clasa .def
O zon de text dintr-un paragraf poate suporta o regul CSS folosind eticheta <SPAN>. Exemplu: <p> <span class=first>E</span>rele mezozoic si neozoic.......</p> .first {font-size:150%; font-weight:bold; } Astfel litera E va fi mai mare i ngro at . AD UDAREA DE COMENTARII: // comentariu pe o linie /* comentariu pe mai multe linii */
h1 { font-style: italic; } [ normal, oblique ] h1 { font-weight: bold; } h1{ font-variant: small-caps; } [ normal, lighter, bolder ] [ normal ]
pag. 4
li { list-style-image: url(bullet1.gif); }
background-attachment
I MARGINI
sdkjfh sdkjhsdjkhf djksh sjh sd sdkhkdjs hjksdh sdjkh sdh sdjkhsdjk hsdjk sdjkfhsdjkhsd jkf hsdjkh sdjkfhsdjk sdjkhsd jkfh sdjkfh sdjkfh sdjkfhsdjkfh sdjkfhsdjkfh sdjkfh sdjkh jkdh fsdjk
sjk jkshd jksd hjk sdj kjk shfks dhfj ksdh sdjkfsd fsdfsd fsd fds sdffsd fsdf sd ds
border
margin
padding
pag. 5
Att marginea, padding-ul ct i bordura pot fi definite pentru fiecare latur n parte.
[ %, auto ]
MARGINI:
p { margin-top: 20px; } sau p { margin: 20px 0 0 0; } [ margin: sus dreapta jos stanga ] ( top, right, bottom, left )
BORDURI:
L individual
L simplificat
border-style [ dotted, dashed, solid, double, groove, ridge, inset, outset ] border-width [ thin, medium, thick, lungime ] Bordura poate fi personalizat pentru fiecare latur : border-left; border-top; border-right etc. PADDING L comun L individual p { padding: 30px; } p { padding-top: 20px; } sau p { padding: 20px 0 0 0; } [ padding: sus dreapta jos stanga ] ( top, right, bottom, left )
9. ALINIEREA IMAGINILOR FA
img { float: left; }
DE TEXT
[ right, none ]
Proprietatea float se aplic cu succes i n cazul <div> -urilor pentru a ezarea acestora n pagin .
II FLOAT
[ right, both, none ]
Foarte util afi area elementelor <li> inline, adic pe aceea i linie. Aceast metod se folose te pentru crearea de meniuri orizontale.
pag. 6
Static este pozi ionarea normal . Pozi ionarea relativ se face n raport cu alte elemente din fereastr (cel mai adesea n raport cu p rinte), specificndu-se pozi ia folosind propriet iile top i left. Pozi ionarea absolut se face n raport cu fereastra. Obiectul poate fi plasat n func ie de col ul sus-stnga (top, left) sau jos-dreapta (bottom, right). Pozitionarea fixed (interesant pentru faptul ca nu suport defilarea mpreun cu con inutul paginii) nu este suportat complet de multe dintre browser-e.
II
[ hidden, visible, inherit ]
pag. 7