Verstehe, was CSS ist und wie man es verwendet, um HTML-Elemente zu gestalten.
<style>), Extern (.css)CSS-Regeln bestehen aus einem Selektor und einem Deklarationsblock:
selector {
property: value;
property: value;
}
Element-Selektor:
p {
color: blue;
font-size: 16px;
}
ID-Selektor:
#main-title {
color: red;
}
Klassen-Selektor:
.button {
background-color: green;
}
<p style="color: blue;"><style> im <head>.css-Datei einbinden mit <link rel="stylesheet" href="style.css">Versuche Folgendes:
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>CSS Übung</title>
<style>
h1 {
color: darkblue;
font-family: Arial, sans-serif;
}
p {
color: gray;
font-size: 14px;
font-family: 'Times New Roman', serif;
}
.button {
background-color: green;
color: white;
padding: 10px 20px;
border: none;
cursor: pointer;
}
</style>
</head>
<body>
<h1 id="main-title">Willkommen zu CSS</h1>
<p>Dies ist ein Absatz, der mit CSS gestaltet wurde.</p>
<button class="button">Klick mich</button>
</body>
</html>