Files
cours/DEV1.2/TP/TP02/style.css
T
2026-11-25 11:15:04 +01:00

246 lines
3.7 KiB
CSS

/* ==========================================================================
1. Les sélecteurs CSS
========================================================================== */
/* 1.1 Les sélecteurs simples */
body {
background-color: #8e167c;
}
p {
color: #222222;
}
.important {
color: #b03a2e;
}
#selecteurs {
color: #1f3a52;
}
/* 1.2 Les sélecteurs structurels */
section p {
color: #1b4f72;
}
section > p {
color: #7b241c;
}
h2 + p {
font-weight: bold;
}
nav li {
list-style-type: none;
}
/* 1.3 Les sélecteurs d'attributs */
a[href] {
color: #1e8449;
}
a[href^="https"] {
color: #1f618d;
}
a[href$=".html"] {
color: #b03a2e;
}
a[href*="w3.org"] {
font-weight: bold;
}
/* 1.4 Les pseudo-classes */
/* 1.4.1 Les pseudo-classes d'état */
a:visited {
color: purple;
}
a:hover {
color: red;
}
a:active {
color: orange;
}
a:focus-visible {
outline: 2px solid #1f618d;
outline-offset: 2px;
background-color: #e8f1f8;
}
/* 1.4.2 Les pseudo-classes structurelles */
li:first-child {
color: #b03a2e;
}
li:last-child {
color: #1f618d;
}
li:nth-child(2) {
font-weight: bold;
}
li:nth-child(odd) {
background-color: #eaecee;
}
li:nth-child(even) {
background-color: #f8f9f9;
}
li:nth-child(3n) {
font-style: italic;
}
li:nth-child(2n + 1) {
letter-spacing: 0.3px;
}
/* ==========================================================================
2. La typographie
========================================================================== */
/* 2.1 Les polices de caractères */
body {
font-family: system-ui, Arial, sans-serif;
}
h1 {
font-family: Georgia, "Times New Roman", serif;
}
h2 {
font-family: "Trebuchet MS", Arial, sans-serif;
}
/* 2.2 La taille et la graisse */
h1 {
font-size: 2rem;
font-weight: 700;
}
h2 {
font-size: 1.5rem;
font-weight: 600;
}
p {
font-size: 1rem;
font-weight: 400;
}
.important {
font-weight: 700;
}
/* 2.3 L'alignement et les espacements */
h1 {
text-align: center;
}
.information p {
text-align: justify;
}
p {
line-height: 1.6;
letter-spacing: 0.5px;
margin-bottom: 1rem;
}
/* 2.4 Les couleurs */
h1 {
color: darkslategray;
}
h2 {
color: #336699;
}
section p {
color: rgb(40, 40, 40);
}
section > p.important {
color: #922b21;
}
header {
background-color: #dce6f1;
padding: 1.5rem;
}
/* ==========================================================================
3. Personnaliser les listes
========================================================================== */
/* 3.1 & 3.2 Marqueurs (valeurs testées : disc, circle, square, none ; inside / outside) */
.technologies {
/* 3.3 Personnaliser les listes */
list-style-type: none;
list-style-position: outside;
padding-left: 0;
}
.technologies li {
margin-bottom: 0.5rem;
padding: 0.5rem 0.75rem;
background-color: #e9eef4;
color: #1f2d3d;
}
.technologies li:nth-child(odd) {
background-color: #d4e0ec;
}
.etapes {
list-style-type: lower-roman;
list-style-position: outside;
}
/* ==========================================================================
4. Personnaliser les tableaux
========================================================================== */
/* 4.1 Les bordures & 4.2 Les dimensions et les espacements */
table {
width: 100%;
border: 2px solid #336699;
border-collapse: collapse;
}
th,
td {
border: 1px solid #99aab5;
padding: 12px 10px;
text-align: left;
}
th {
text-align: center;
}
/* 4.3 Alterner les couleurs des lignes */
thead tr {
background-color: #336699;
color: #ffffff;
}
tbody tr:nth-child(odd) {
background-color: #eeeeee;
}
tbody tr:nth-child(even) {
background-color: #ffffff;
}
tbody tr:hover {
background-color: lightblue;
}