210 likes | 430 Views
CSS. Kaskádové štýly. CSS – C ascading S tyle S heets zobrazovanie HTML elementov vytváranie externý súborov . css. Použitie štýlov. 3 spôsoby: e xterné CSS súbory, interný štýl, inline ( priamy ) štýl. Externé Css súbory. <! doctype html> <html> < head >
E N D
CSS Kaskádové štýly
CSS – CascadingStyleSheets • zobrazovanie HTML elementov • vytváranie externý súborov .css
Použitie štýlov • 3 spôsoby: • externé CSS súbory, • interný štýl, • inline (priamy)štýl.
Externé Css súbory • <!doctype html> • <html> • <head> • <title>Externe Csssubory</title> • <linkrel="stylesheet" type="text/css" href="styly.css"> • </head> • <body> • <h1>Ukazka pouzitiaexternychcss suborov</h1> • </body> • </html>
súbor: styly.cssbody{background-color: lightblue;}h1 {font-size: 20px;text-align:left; font-weight: bold;color:blue;}
Interný štýl <head> <title>Internystyl</title> <style> body {background-color: lightblue;} h1 {font-size: 20px;text-align:left; font-weight: bold;color:blue;} </style> </head> <body> <h1>Ukazka pouzitiainterneho stylu</h1> </body>
Inline(priamy) štýl <head> <title>Inlinestyl</title> </head> <body style="background-color:lightblue;"> <h1 style="font-size: 20px;text-align:left;font-weight: bold;color:blue;"> Ukazkapouzitiainline stylu</h1> </body>
Nastavenie pozadia • background-color • background-image • background-repeat (no-repeat,repeat-x(y)) • background-attachment (scroll, fixed) • background-position (top, center, bottom, left,right)
Background-color • HEX - # • RGB – rgb(,,) • meno farby <body style="background-color:RGB(255,128,0);"> </body> Background- transparent (priehľadné pozadie)
Background-image <head> <title>Pozadie</title> </head> <body style="backgroundcolor:green;"> <p style="background-image: url('obrazok2.jpg');width:162px; height:172px;float:left;"> </p> </body>
Background-repeat <head> <title>Pozadie</title> </head> <body style="background-color: green; background-image: url('obrazok2.jpg'); background-repeat:repeat-y;"> </body>
Nastavenie textov • text-color • text-align (left,right,center,justify) • text–decoration (none,underline,overline,line-through,blink) • text-transform (none, capitalize, uppercase,lowercase) • text-indent
body {background-color:blue;} h1 { color:white; text-align:center; text-decoration:underline; text-transform:uppercase; text-indent:50px;} p {color:#ffffff; text-align:right; text-decoration:none; text-transform:capitalize; text-indent:100px;}
Nastavenie fontov • font-family • font-style (normal, italic, oblique) • font-size (small, medium, large, px,%, ….)
body {background-color: blue;} h1 { color:white;text-align:center;text- decoration:underline;text-transform:uppercase; text-indent:50px; font-family:Times New Roman; font-style:italic; font-size:50px;} p {color:#ffffff;text-align:right;textdecoration:none; text-transform:capitalize; text-indent:100px; font-family:Arial CE; font-style:normal; font-size:1.8em;}
Nastavenie odkazov • a:link – (normálny, základný stav odkazu) • a:visited – (stav kedy užívateľ použil odkaz) • a:hover - (stav keď kurzor myši je na ňom ) • a:active - (stavv momente kliknutia)
a:link {color: green; text-decoration: underline; background-color:#ffffff;} a:visited {background-color:lightblue;color: green; text-decoration: underline; } a:hover {background-color:yellow;color: green; text-decoration: underline; } a:active {background-color:pink;color: green; text-decoration: underline;}
Nastavenie tabuliek • table • border • border-collapse (separate, collapse) • width • height • text-align • padding • backgroud-color
<body style="background-color: white;font-size: 20px;text-align: left;font-weight: bold;"> <div> tabulka:</div><br> <tablestyle="border: 2px blacksolid;border-collapse: collapse; float:left;width: 40%;text-align: center;"> <trstyle="background-color: greenyellow;border: 2px blacksolid;"> <thstyle="width: 50%;">1.stlpec</th><th style="width:50%;">2.stlpec</th></tr> <trstyle="background-color: yellow;"> <td>text</td><td>text</td></tr> <trstyle="background-color: greenyellow;"> <td>text</td><td>text</td></tr> <trstyle="background-color: yellow;"> <td colspan="2">text</td></tr> </table> </body>