Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Sposób na "Duplicate ID"
Forum PHP.pl > Forum > Po stronie przeglądarki > CSS
Maciek_#_&
Dzień dobry,

Czy jest jakiś sposób żeby dwa te same ID nie tworzyły błędu wg w3c ? jest to mało istotne, ale ciekawi mnie rozwiązanie.
Przykład:
<a href="link" id="emot">Link</a>
Nie tworzy błędu, jednak
<a href="link" id="emot">Link</a>
<a href="link" id="emot">Link</a>
Już tak...

Damonsson
Document languages may contain attributes that are declared to be of type ID. What makes attributes of type ID special is that no two such attributes can have the same value; whatever the document language, an ID attribute can be used to uniquely identify its element. In HTML all ID attributes are named "id"; XML applications may name ID attributes differently, but the same restriction applies.

The ID attribute of a document language allows authors to assign an identifier to one element instance in the document tree. CSS ID selectors match an element instance based on its identifier. A CSS ID selector contains a "#" immediately followed by the ID value, which must be an identifier.


http://www.w3.org
Maciek_#_&
Aha, czyli "class" rozwiąże problem, dzięki smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.