1.3 Verschiedene Selektoren für die Zuweisung von Stilen

Problem

Sie wollen Selektoren verwenden, um bestimmten Teilen einer Website ihre eigenen Stildefinitionen zuzuweisen.

Lösung

Mit Hilfe spezieller Selektoren können Sie Stildefinitionen auch nur auf ganz bestimmte Teile einer Webseite anwenden (siehe Abbildung 1-6):

<html>
 <head>
  <title>CSS Kochbuch</title>
  <style type="text/css">
  <!--
  *{
font-family: verdana, arial, sans-serif;
  }
  h1 {
  font-size: 120%;
  }
  #navigation {
  border: 1px solid black;
  padding: 40px;
  }
  li a {
  text-decoration: none;
  }
  p {
  font-size: 90%;
  }
  -->
  </style> </head> <body> <h1>Seitenüberschrift</h1> <p>Dies ist ein Beispielabsatz mit einem <a href="http://csscookbook.com">Link</a>. Lorem ipsum dolor sit amet, ...

Get CSS Kochbuch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.