Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Data jako selektor
Forum PHP.pl > Forum > Po stronie przeglądarki > CSS
hobibit
Witam, chciałem zapytać o możliwości zarządzania css za pomocą data

Można używać data w taki sposób:
  1. <div data-numer="2">
  2.  
  3. [data-numer="2"] {
  4. /* Styles */
  5. }


Czy jest jakiś sposób (ja nie znalazłem chociaż trochę szukałem) żeby zrobić coś takiego:
  1. [data-numer>"2"] {
  2. /* Styles */
  3. }
rocktech.pl
Witam.

Zerknij na dokumentację selektorów atrybutów w CSS.

  1. *[data-numer=2] {
  2. color : red
  3. }
hobibit
Nie to próbuje zrobić. Podstawowa opcja działa bez problemu. Ale chce zrobić selektor który będzie edytować wszystkie div-y z data-numer większe niż 2 (na przykład).
rocktech.pl
Na ten moment masz do dyspozycji.

Cytat
E[foo="bar"] an E element whose "foo" attribute value is exactly equal to "bar" (atrybut równa się "bar")
E[foo~="bar"] an E element whose "foo" attribute value is a list of whitespace-separated values, one of which is exactly equal to "bar" (atrybut zawiera "bar" "bar bar2")
E[foo^="bar"] an E element whose "foo" attribute value begins exactly with the string "bar" (atrybut zaczyna się od "bar")
E[foo$="bar"] an E element whose "foo" attribute value ends exactly with the string "bar" (atrybut kończy się na "bar")
E[foo*="bar"] an E element whose "foo" attribute value contains the substring "bar" (atrybut zawiera "bar")
E[foo|="en"] an E element whose "foo" attribute has a hyphen-separated list of values beginning (from the left) with "en" (zaczyna się od "en" "en-US")


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.