HTML-Syntax (Satzlehre/Rechtschreibung) steht stets in einer HTML-Datei. Entsprechend steht CSS- und JS-Syntax in den entsprechenden Dateien. Allerdings steht CSS-Syntax auch zwischen <style type="text/css"> und </style> sowie innerhalb des style="" Attributs. Entsprechend steht JS-Syntax auch zwischen <script> und </script> sowie als Referenz mit dem Schema „javascript:“ (<a href="javascript:">) und nach HTML-Ereignissen wie onload="".
| Konstrukt | HTML | CSS | JavaScript |
|---|---|---|---|
| Anweisung | <leerestag /> | @import | Anweisung; |
| Funktion | <starttag> </endtag> | Selektor { } | Funktion () { } |
| Zuweisung | attribut="wert" | eigenschaft: wert; | variable = wert; |
| Bedingung | onload="wert" | @media print {} | if (Bed) { Anw; } |
| Schleife | * | for (Bed) { Anw; } | |
| Kommentar | <!-- Kommentar --> | /* Kommentar */ // bis Zeilenende | /* Kommentar */ // bis Zeilenende |
| HTML | CSS | JavaScript |
|---|---|---|
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" *content="text/html; charset=UTF-8" /> <title>Meine Visitenkarte</title> <script src="funktionen.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="vorlagen.css" /> <style type="text/css"> address { font-style:normal; } </style> </head> <body> <p> <span id="Name">Christian Hartnick</span><br /> <span id="Grad">Dipl.-Wirtsch.-Inf.</span><br /> <span class="Kursiv">Freier Berater</span> <address> Sandweg 10 <br /> 16727 Oberkrämer OT Bärenklau </address> <p> <script type="text/javascript"> insertEmail("hilfe","hartnick","de") </script> <noscript> hilfe_at_hartnick_._de </noscript><br /> <a href="http://hilfe.hartnick.de"> hilfe.hartnick.de </a> </p> </body> </html> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" *content="text/html; charset=UTF-8" /> <title>Impressum</title> <script src="funktionen.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="vorlagen.css" /> </head> <body> <p> … </p> </body> </html> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" *content="text/html; charset=UTF-8" /> <title>Bildergallerie</title> <script src="funktionen.js" type="text/javascript"></script> <script src="gallerie.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="vorlagen.css" /> <link rel="stylesheet" type="text/css" href="gallerie.css" /> </head> <body> <p> … </p> </body> </html> |
#Name { font-weight:bold; }
#Grad { font-weight:lighter; }
.Kursiv { font-style:italic; }
a { text-decoration:none;
color:WindowText;}
a:before { content:"\21d2";
color:#0000ff; }
a:hover { color:#0000ff; }
… |
function insertEmail(name,domain,tld) {
document.write(
'\n<a href=\"mailto:'
+name+'@'+domain+'.'+tld+'\">'
+name+'@'+domain+'.'+tld
+'</a>');
}
… |