Skip to content

Instantly share code, notes, and snippets.

@Perun
Created February 22, 2016 16:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Perun/b55fa083f04d41a44957 to your computer and use it in GitHub Desktop.
Erste .klasse ansprechen

Erste .klasse ansprechen

Es geht darum das erste Element mit einem speziellen Klassen-Wert (class="hinweis") anzusprechen.

A Pen by Vlad on CodePen.

License.

<div id="inhalt">
<h3>Irgendeine Überschrift</h3>
<div>
<p>Textbox</p>
</div>
<p class="hinweis">Kleiner Absatz</p>
<p>Kleiner Absatz</p>
<p class="hinweis">Kleiner Absatz</p>
<p>Kleiner Absatz</p>
<p class="hinweis">Kleiner Absatz</p>
</div>
.hinweis {background: #fdc; border: 1px solid #c50;}
.hinweis:first-of-type {background: #aef; border: 1px solid #08a;}
#inhalt > :first-child {background:#eee; border: 1px solid #ddd;}
h3, p {padding: .25rem;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment