font-size- vlastnost pro změnu velikosti textu
pixelech
<!DOCTYPE html>
<html>
<head>
<style>
p {
font-size: 20px;
}
</style>
</head>
<body>
<p>Ahoj Honzo</p>
</body>
</html>
font-family- vlastnost pro změnu fontu
<!DOCTYPE html>
<html>
<head>
<style>
p {
font-family: Arial;
}
</style>
</head>
<body>
<p>Ahoj Honzo</p>
</body>
</html>
font-weight- vlastnost pro změnu tloušťky textu
100do
900a
bold,
normal
<!DOCTYPE html>
<html>
<head>
<style>
p {
font-weight: bold;
}
</style>
</head>
<body>
<p>Ahoj Honzo</p>
</body>
</html>
font-style- vlastnost pro změnu stylu textu
italic,
normal
<!DOCTYPE html>
<html>
<head>
<style>
p {
font-style: italic;
}
</style>
</head>
<body>
<p>Ahoj Honzo</p>
</body>
</html>
text-decoration- vlastnost pro dekoraci textu
underline,
line-through,
overline
<!DOCTYPE html>
<html>
<head>
<style>
p {
text-decoration: underline;
}
</style>
</head>
<body>
<p>Ahoj Honzo</p>
</body>
</html>
text-align- vlastnost pro zarovnání textu
left,
right,
center,
justify
<!DOCTYPE html>
<html>
<head>
<style>
p {
text-align: center;
}
</style>
</head>
<body>
<p>Ahoj Honzo</p>
</body>
</html>
text-transform- vlastnost pro transformaci textu
uppercase,
lowercase,
capitalize
<!DOCTYPE html>
<html>
<head>
<style>
p {
text-transform: uppercase;
}
</style>
</head>
<body>
<p>Ahoj Honzo</p>
</body>
</html>
red,
blue,
green
p {
color: red;
}
#RRGGBB
#ff0000,
#00ff00,
#0000ff
p {
color: #ff0000;
}
0do
255
rgb(255, 0, 0),
rgb(0, 255, 0),
rgb(0, 0, 255)
p {
color: rgb(255, 0, 0);
}
0do
255a
0až
1
rgba(255, 0, 0, 0.5),
rgba(0, 255, 0, 0.5),
rgba(0, 0, 255, 0.5)
p {
color: rgba(255, 0, 0, 0.5);
}
background-color
<!DOCTYPE html>
<html>
<head>
<style>
body{
background-color: red;
}
</style>
</head>
<body>
<p>Ahoj Honzo</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div {
color: red;
}
</style>
</head>
<body>
<p>Ahoj Honzo</p>
<div>
<p>Ahoj Honzo</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
body {
font-family: Arial;
font-size: 18px;
}
.container {
color: blue;
}
</style>
</head>
<body>
<div class="container">
<h2>Nadpis</h2>
<p>Tento text zdědí font a velikost z body a barvu z containeru</p>
<span>I tento span má stejné vlastnosti</span>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
.rodic {
color: green;
font-size: 20px;
font-weight: bold;
}
.potomek {
color: orange;
/* font-size a font-weight se zdědí */
}
</style>
</head>
<body>
<div class="rodic">
<p>Rodičovský text - zelený</p>
<p class="potomek">Potomek - oranžový, ale velký a tučný</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
.pradedecek {
font-family: Arial;
color: darkblue;
}
.dedecek {
font-size: 16px;
}
.rodic {
font-weight: bold;
}
/* potomek nedefinuje žádné styly */
</style>
</head>
<body>
<div class="pradedecek">
<div class="dedecek">
<div class="rodic">
<p class="potomek">Zdědil: Arial, modrou, 16px, tučné</p>
</div>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
div {
padding: 5px;
background-color: cadetblue;
width: 100px;
height: 100px;
border-radius: 3px;
}
div p{
color: white;
}
</style>
</head>
<body>
<div>
<p>Toto je div</p>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
span {
color: cadetblue;
font-weight: bold;
}
</style>
</head>
<body>
<p><span>Ahoj</span>, já jsem <span>span</span>.</p>
</body>
</html>
idse k ní můžeme dostat
<!DOCTYPE html>
<html>
<head>
<style>
a {
color: cadetblue;
font-weight: bold;
}
h1{
margin-top: 500px;
}
</style>
</head>
<body>
<a href="#kotva">Klikni zde</a>
<h1 id="kotva">Vítej na kotvě!</h1>
</body>
</html>