Tutorial 8: Some Selectors for css + jquery
X + Y
- ul + p {
- color: red;
- }
X > Y
- div#container > ul {
- border: 1px solid black;
- }
will only select direct children.
X ~ Y
- ul ~ p {
- color: red;
- }
X[href="foo"]
- a[href="http://net.tutsplus.com"] {
- color: #1f6053; /* nettuts green */
- }
- a[href^="http"] { //start with http
- a[href$=".jpg"] { //end with jpg
X:checked
- input[type=radio]:checked {
- border: 1px solid black;
- }
X:not(selector)
- div:not(#container) {
- color: blue;
- }
select all divs, except for the one which has an
id
of container
.p::first-letter {
p::first-line {
li:nth-child(3) {
li:nth-last-child(2) {
ul li:first-child {
ul > li:last-child {
X:only-of-type
- li:only-of-type {
- font-weight: bold;
- }
will target elements that do not have any siblings within its parent container.
Sources:
http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/
http://net.tutsplus.com
http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-getting-clever-with-css3-shadows/
http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/
http://net.tutsplus.com
http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-getting-clever-with-css3-shadows/
Comments
Post a Comment