<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://fi-wiki.de/index.php?action=history&amp;feed=atom&amp;title=Klassen_und_IDs</id>
	<title>Klassen und IDs - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://fi-wiki.de/index.php?action=history&amp;feed=atom&amp;title=Klassen_und_IDs"/>
	<link rel="alternate" type="text/html" href="https://fi-wiki.de/index.php?title=Klassen_und_IDs&amp;action=history"/>
	<updated>2026-05-06T14:59:57Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in FI-Wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://fi-wiki.de/index.php?title=Klassen_und_IDs&amp;diff=2491&amp;oldid=prev</id>
		<title>Moettke am 18. Februar 2026 um 09:59 Uhr</title>
		<link rel="alternate" type="text/html" href="https://fi-wiki.de/index.php?title=Klassen_und_IDs&amp;diff=2491&amp;oldid=prev"/>
		<updated>2026-02-18T09:59:19Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Version vom 18. Februar 2026, 09:59 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;HTML-Elemente können mit &amp;#039;&amp;#039;&amp;#039;Klassen&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt;) und &amp;#039;&amp;#039;&amp;#039;IDs&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;) versehen werden.   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;HTML-Elemente können mit &amp;#039;&amp;#039;&amp;#039;Klassen&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt;) und &amp;#039;&amp;#039;&amp;#039;IDs&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;) versehen werden.   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Diese dienen dazu, Elemente gezielt mit CSS zu gestalten oder mit JavaScript anzusprechen.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Diese dienen dazu, Elemente gezielt mit &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Grundlagen &lt;/ins&gt;CSS&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;|CSS]] &lt;/ins&gt;zu gestalten oder mit JavaScript anzusprechen.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Klassen (class) ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Klassen (class) ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key fiwikidb143:diff:1.41:old-2486:rev-2491:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Moettke</name></author>
	</entry>
	<entry>
		<id>https://fi-wiki.de/index.php?title=Klassen_und_IDs&amp;diff=2486&amp;oldid=prev</id>
		<title>Moettke: Die Seite wurde neu angelegt: „HTML-Elemente können mit &#039;&#039;&#039;Klassen&#039;&#039;&#039; (&lt;code&gt;class&lt;/code&gt;) und &#039;&#039;&#039;IDs&#039;&#039;&#039; (&lt;code&gt;id&lt;/code&gt;) versehen werden.   Diese dienen dazu, Elemente gezielt mit CSS zu gestalten oder mit JavaScript anzusprechen.  == Klassen (class) == * können mehrfach auf einer Seite verwendet werden   * ein Element kann mehrere Klassen besitzen    Beispiel:  &lt;syntaxhighlight lang=&quot;html&quot;&gt; &lt;p class=&quot;wichtig&quot;&gt;Achtung!&lt;/p&gt; &lt;p class=&quot;wichtig&quot;&gt;Noch ein Hinweis.&lt;/p&gt; &lt;/syntaxhighlight&gt;…“</title>
		<link rel="alternate" type="text/html" href="https://fi-wiki.de/index.php?title=Klassen_und_IDs&amp;diff=2486&amp;oldid=prev"/>
		<updated>2026-02-18T09:47:42Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „HTML-Elemente können mit &amp;#039;&amp;#039;&amp;#039;Klassen&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt;) und &amp;#039;&amp;#039;&amp;#039;IDs&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;) versehen werden.   Diese dienen dazu, Elemente gezielt mit CSS zu gestalten oder mit JavaScript anzusprechen.  == Klassen (class) == * können mehrfach auf einer Seite verwendet werden   * ein Element kann mehrere Klassen besitzen    Beispiel:  &amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot;&amp;gt; &amp;lt;p class=&amp;quot;wichtig&amp;quot;&amp;gt;Achtung!&amp;lt;/p&amp;gt; &amp;lt;p class=&amp;quot;wichtig&amp;quot;&amp;gt;Noch ein Hinweis.&amp;lt;/p&amp;gt; &amp;lt;/syntaxhighlight&amp;gt;…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;HTML-Elemente können mit &amp;#039;&amp;#039;&amp;#039;Klassen&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt;) und &amp;#039;&amp;#039;&amp;#039;IDs&amp;#039;&amp;#039;&amp;#039; (&amp;lt;code&amp;gt;id&amp;lt;/code&amp;gt;) versehen werden.  &lt;br /&gt;
Diese dienen dazu, Elemente gezielt mit CSS zu gestalten oder mit JavaScript anzusprechen.&lt;br /&gt;
&lt;br /&gt;
== Klassen (class) ==&lt;br /&gt;
* können mehrfach auf einer Seite verwendet werden  &lt;br /&gt;
* ein Element kann mehrere Klassen besitzen  &lt;br /&gt;
&lt;br /&gt;
Beispiel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;wichtig&amp;quot;&amp;gt;Achtung!&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p class=&amp;quot;wichtig&amp;quot;&amp;gt;Noch ein Hinweis.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CSS dazu:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
.wichtig {&lt;br /&gt;
  color: red;&lt;br /&gt;
  font-weight: bold;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Das Punktzeichen (&amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt;) steht in CSS für eine Klasse.&lt;br /&gt;
&lt;br /&gt;
== IDs (id) ==&lt;br /&gt;
* dürfen pro Seite nur &amp;#039;&amp;#039;&amp;#039;einmal&amp;#039;&amp;#039;&amp;#039; vorkommen  &lt;br /&gt;
* identifizieren ein Element eindeutig  &lt;br /&gt;
&lt;br /&gt;
Beispiel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;p id=&amp;quot;info&amp;quot;&amp;gt;Wichtige Information&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
CSS dazu:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
#info {&lt;br /&gt;
  color: blue;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Das Rautezeichen (&amp;lt;code&amp;gt;#&amp;lt;/code&amp;gt;) steht in CSS für eine ID.&lt;br /&gt;
&lt;br /&gt;
== Unterschied zwischen class und id ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%; text-align:center;&amp;quot;&lt;br /&gt;
! Merkmal !! class !! id&lt;br /&gt;
|-&lt;br /&gt;
| Mehrfach verwendbar || Ja || Nein&lt;br /&gt;
|-&lt;br /&gt;
| Eindeutig pro Seite || Nein || Ja&lt;br /&gt;
|-&lt;br /&gt;
| CSS-Schreibweise || .name || #name&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Kurzmerksatz ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Klassen gruppieren mehrere Elemente, IDs kennzeichnen ein einzelnes Element eindeutig.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
== Spezifität (Priorität von CSS-Regeln) ==&lt;br /&gt;
&lt;br /&gt;
Wenn mehrere CSS-Regeln auf dasselbe Element zutreffen, entscheidet die sogenannte &amp;#039;&amp;#039;&amp;#039;Spezifität&amp;#039;&amp;#039;&amp;#039;, welche Regel angewendet wird.&lt;br /&gt;
&lt;br /&gt;
Grundsätzlich gilt:&lt;br /&gt;
&lt;br /&gt;
* ID-Selektoren haben eine höhere Priorität als Klassen&lt;br /&gt;
* Klassen haben eine höhere Priorität als Element-Selektoren&lt;br /&gt;
* Spätere Regeln können frühere überschreiben&lt;br /&gt;
&lt;br /&gt;
Beispiel:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;html&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;p id=&amp;quot;info&amp;quot; class=&amp;quot;wichtig&amp;quot;&amp;gt;Text&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;css&amp;quot;&amp;gt;&lt;br /&gt;
p { color: black; }&lt;br /&gt;
.wichtig { color: red; }&lt;br /&gt;
#info { color: blue; }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Ergebnis:&lt;br /&gt;
Der Text wird &amp;#039;&amp;#039;&amp;#039;blau&amp;#039;&amp;#039;&amp;#039; dargestellt, da die ID die höchste Spezifität besitzt.&lt;br /&gt;
&lt;br /&gt;
== Reihenfolge der Spezifität ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;width:100%; text-align:center;&amp;quot;&lt;br /&gt;
! Selektor !! Beispiel !! Priorität&lt;br /&gt;
|-&lt;br /&gt;
| Element || p || niedrig&lt;br /&gt;
|-&lt;br /&gt;
| Klasse || .wichtig || mittel&lt;br /&gt;
|-&lt;br /&gt;
| ID || #info || hoch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Merksatz ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Je spezifischer ein Selektor ist, desto höher ist seine Priorität.&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;</summary>
		<author><name>Moettke</name></author>
	</entry>
</feed>