CSS atributy
Toto je príklad použitia atributov v css. Príklad formátuje výstup z polí na základe atributu title. Pokial do poľa s menom zadáte jedno z nasledujúcich slov: sex, spammer, viagra, free, bitch, product a porno, zobrazia sa na červeno. Funguje to pomocou použitia selektora atributu, v tomto prípade [title~="text"].
Upozornenie: Príklad je nefunkčný pod Internet Explorerom 6 a starším.
CSS:
label { clear: both; display: block;}
form { clear: both;}
input {border: 1px solid #ccc; background-color: #f5f5f5;}
input[name="meno"] {margin: 0 0 0 4px;}
input[type="submit"] { clear: both; margin: 10px 0 0 0; display: block;}
input[name="meno"]:focus, input[name="mail"]:focus {background-color: yellow;}
fieldset { clear: both; border: none;}
a[href] { color: gray; text-decoration: underline;}
a[title~="spammer"], a[title~="sex"], a[title~="product"], a[title~="bitch"], a[title~="free"], a[title~="porno"], a[title~="viagra"] { color: red;}
form { clear: both;}
input {border: 1px solid #ccc; background-color: #f5f5f5;}
input[name="meno"] {margin: 0 0 0 4px;}
input[type="submit"] { clear: both; margin: 10px 0 0 0; display: block;}
input[name="meno"]:focus, input[name="mail"]:focus {background-color: yellow;}
fieldset { clear: both; border: none;}
a[href] { color: gray; text-decoration: underline;}
a[title~="spammer"], a[title~="sex"], a[title~="product"], a[title~="bitch"], a[title~="free"], a[title~="porno"], a[title~="viagra"] { color: red;}
Podpora od: Opera 9.5, Firefox 2, Internet Explorer 7, Safari 3, Google Chrome 0.4
Podobné články:
