a[target="_blank"] {
background-color: yellow;
}
/*w3schools*/
[class^='aus'] {
/* Classes are attributes too!
This will target any class that begins with 'aus':
class='austria'
class='australia'
*/
}
[src$='.jpg'] {
/* This will target any src attribute that ends in '.jpg':
src='puppy.jpg'
src='kitten.jpg'
*/
}
[for*='ill'] {
/* This will target any for attribute that has 'ill' anywhere inside it:
for="bill"
for="jill"
for="silly"
for="ill"
*/
}
/*Advanced selectors*/
h2 + p /*every paragraph that is after "h2" */
textarea ~ button /*every button that is aftrer textarea with same parent (<form> is the same parent in this example)*/
ul > li /*every signle "li" inside of the "ul"*/
ul li /*every "li" that goes up to "ul"*/
/*Attribute selectors*/
p[class="review"] /*all of paragraphs with review class on them*/
img[href^="../my code guide/"] /*every image that starts with that addres (replacing "=" with"^=")*/
img[href$="../my code guide/"] /* its end with this attribute*/
img[href*="../my code guide/"] /*if its contain anywhere*/
h1[class~="site-header"] /*only works with white space seperator*/
h1[class|="subtitle"] /*selects ones that starts with "subtitle" or "subtitle" and "-" in following*/
/*Advanced selectors*/
h2 + p /*every paragraph that is after "h2" */
textarea ~ button /*every button that is aftrer textarea with same parent (<form> is the same parent in this example)*/
ul > li /*every signle "li" inside of the "ul"*/
ul li /*every "li" that goes up to "ul"*/
/*Attribute selectors*/
p[class="review"] /*all of paragraphs with review class on them*/
img[href^="../my code guide/"] /*every image that starts with that addres (replacing "=" with"^=")*/
img[href$="../my code guide/"] /* its end with this attribute*/
img[href*="../my code guide/"] /*if its contain anywhere*/
h1[class~="site-header"] /*only works with white space seperator*/
h1[class|="subtitle"] /*selects ones that start with "subtitle" or "subtitle" and "-" in following*/
a[target] {
background-color: yellow;
}
/* <a> elements with a title attribute */
a[title] {
color: purple;
}
/* <a> elements with an href matching "https://example.org" */
a[href="https://example.org"]
{
color: green;
}
/* <a> elements with an href containing "example" */
a[href*="example"] {
font-size: 2em;
}
/* <a> elements with an href ending ".org" */
a[href$=".org"] {
font-style: italic;
}
/* <a> elements whose class attribute contains the word "logo" */
a[class~="logo"] {
padding: 2px;
}
Code Example |
---|
Css :: font face css |
Css :: disabled checkbox css |
Css :: glass css |
Css :: jquery add external css to head |
Css :: form layout with glassmorphism css |
Css :: carbon today date with 12 00 am |
Css :: ellipsis css |
Css :: display content in column css |
Css :: css background offset |
Css :: wordpress theme my login redirect after login |
Css :: put gradient color over background image |
Css :: css not |
Css :: css textarea set max characters |
Css :: mix color using css |
Css :: css selector label for |
Css :: css input border radius focus |
Css :: css selector color |
Css :: remove bg color with css |
Css :: grid css |
Css :: css all uppercase to capitalize |
Css :: reset div css |
Css :: linear gradient tailwind css |
Css :: title underline |
Css :: how to desactivate txt selection css |
Css :: width css |
Css :: create shadow css |
Css :: fonmt family css |
Css :: css text slider animation |
Css :: how to dedeclare a variable and use it in css |
Css :: @container |