Search
 
SCRIPT & CODE EXAMPLE
 

CSS

css select with attribute

div[attribute="value"] {
	/*Your styles*/
}
Comment

attribute selectors css

[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"
  */
}
Comment

attribute selectors in css

/*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*/
Comment

attribute selectors in css

/*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*/
Comment

PREVIOUS NEXT
Code Example
Css :: espacio entre lineas css 
Css :: css overflow elipsis 
Css :: html how to indent text 
Css :: rotate image css 
Css :: css text gradient 
Css :: space between flexbox 
Css :: table font size 
Css :: css calc 
Css :: remove scrollbars scroll 
Css :: vertical hr 
Css :: line in css div 
Css :: change element in iframe 
Css :: css margin left 
Css :: javavscript use .filter to return odd numbers in an array 
Css :: how to give text stroke in css 
Css :: background color css 
Css :: delected blue border when an input is selected 
Css :: select dropdown icon change 
Css :: css checkbox':checked change color 
Css :: change size material checkbox 
Css :: bootstrap breakpoints 
Css :: ng-deep 
Css :: how to make text transparent with stroke in css 
Css :: display content in column css 
Css :: bootstrap cheat sheet 
Css :: css banner image 
Css :: css hide mark border 
Css :: css hsla 
Css :: css media queries mobile first 
Css :: bootstrap modal resize with jquery 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =