11 April 2020
CSS
Table des matières
<!DOCTYPE html>
<html lang="fr">
<head>
<title>Titre de la page</title>
<meta charset="utf-8">
<link rel="stylesheet" href="monfichier.css" />
</head>
<body>
</body>
</html>
p{
color: red;
}
p, h1{
color: red;
}
*{
color: red;
}
h1 + p{
color: red;
}
<p style="color: red;">tout se paragraphe en rouge</p>
<h1>Mon <em>super</em> site</h1>
<p>Pour le moment, mon site est pas très <em>beau</em>. dsl</p>
h1 em{
color: red;
}
<p class="introduction">se paragraphe en rouge</p> /* "introduction" exemple chosir un nom */
<h1 class="introduction">se titre en rouge</h1>
.introduction{
color: red;
}
<p id="introduction">se paragraphe en rouge</p>
#introduction{
color: red;
}
Différence entre attribut CLASS / ID
<p>Bonjour et <span class="introduction">bienvenue</span> sur mon site</p>
<div>
Texte
</div>
/* Commentaire */
font-size: 14px; /* taille du texte */
font-size: 1.5em; /* taille du texte */
font-famyly: Impact, "Arial Black"; /* la police si l'ordinateur ne possède pas impact passe a la suivante */
font-style: italic; /* italique */
font-weight: bold; /* Gras */
text-decoration: underline; /* souligne le texte */
text-decoration: overline; /* ligne au dessu du texte */
text-decoration: line-through; /* barre le texte */
text-align: left; /* le texte a gauche par defaut */
text-align: center; /* centre le texte */
text-align: right; /* le texte a droite */
text-align: justify; /* pour avoir un texte aligné a droite et au gauche */
padding: 1px 2px 3px 4px;
Sens des aiguilles d'une montre
padding: 1px 2px 3px;
padding: 1px 2px;
padding: 1px;
p{
color: red;
}
h1
{
background-color: red;
}
body
{
background-color: red;
}
body
{
background-image: url("nom.jpg");
background-attachement: fixed;
background-repeat: no-repeat;
background-position: top right;
}
ou
body
{
background-image: url("nom.jpg") fixed no-repeat;
}
h1
{
background-color: black;
color: white;
opacity: 0.6;
}
opacity: valeur 1 = visible
opacity: valeur 0 = non visible
background-couleur: rgba(255, 0, 0, 0.5)
0.5 = valeur visible.