XHTML und Stylesheets
lise
- css
0 CarstenP
Liebe Leute,
könnt Ihr mir sagen wie ich in XHTML stylesheets einbinde, die in der Datei liegen und eine id haben.
Beispeilcode:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
<head>
<title>News</title>
<link href="style/slideMenu.css" rel="stylesheet" type="text/css" />
<link href="style/winMenu.css" rel="stylesheet" type="text/css" />
<link href="style/news.css" rel="stylesheet" type="text/css" />
<link href="style/vertMenu.css" rel="stylesheet" type="text/css" />
<link href="style/activ.css" rel="stylesheet" type="text/css" />
<style id="JoustStyles" type="text/css">
.menuItemOut {position:absolute; visibility:hidden;}
.menuItem BR { clear: both;}
.node { color: black; font-family : "Helvetica", "Arial", "MS Sans Serif", sans-serif;font-size : 9pt;}
.node A:link { color: black; text-decoration: none; }
.node A:visited { color: black; text-decoration: none; }
.node A:active { color: black; text-decoration: none; }
.node A:hover { color: #CC0000; text-decoration: none; }
.leaf { color: black; font-family : "Helvetica", "Arial", "MS Sans Serif", sans-serif;font-size : 9pt;}
.leaf A:link { color: black; text-decoration: none;}
.leaf A:visited { color: black; text-decoration: none; }
.leaf A:active { color: black; text-decoration: none; }
.leaf A:hover { color: #CC0000; text-decoration: none; }
</style>
Den stylesheete mit Id kann ich nicht auslagern, sonst läuft meine Navigation nicht. Geht das überhaupt mit Id, das meckert mir der W3c validator an.
Wie mach ich das am besten xhtml-konform?
Schon mal danke
Lise
Hallo Lise,
könnt Ihr mir sagen wie ich in XHTML stylesheets einbinde, die in der Datei liegen und eine id haben.
"id" ist für style (und ein paar andere Elemente) nicht erlaubt (auch in HTML 4.01 nicht).
Ansonsten sieht Dein Code in Ordnung aus. Bloß noch ein paar Kleinigkeiten:
Die richtige Reihenfolge der Pseudoklassen ist :link :visited: :hover :active
Falls das ein Stylesheet für die Monitordarstellung ist (wovon ich mal ausgehe), dann benutze für die Schriftgrößen die Einheit px statt pt (wenn Du schon fixe Schriftgrößen benutzen mußt...). Der Rechner muß die Angabe sowieso auf Pixel umrechnen. Und Windows-Rechner und Mac-Rechner benutzen hier unterschiedliche Umrechnungsfaktoren (Win: 96 dpi; Mac: 72 dpi). Das hat zur Folge, daß die ohnehin kleine Schrift auf einem Mac zu Fliegensch*** wird...