Advertisement
bulrush

CSS2018

Sep 29th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. # CSS notes 2018
  2.  
  3. /* Pastebin.org
  4. Updated: 3/14/2020
  5.  
  6. # Basic CSS
  7.  
  8. * background-color:COLOR;
  9. * color:COLOR or rgb(r,g,b);
  10. * font:FONTNAME;
  11. * font-size: [150%|10px|large];
  12.  
  13. @-moz-document domain(pastebin.com)
  14.  
  15. - Selectors:
  16. htmltag.class {stuff}
  17. tag#id {stuff}
  18.  
  19. tag1,tag2 {CSS} // Apply this style to tag1 OR tag2
  20. tag1 tag2 {CSS stuff} // This means tag1 followed by all tag2 below tag1 at any level.
  21. tag1>tag2 {stuff} // Select where tag2 is the immediate child of tag1.
  22. .class {stuff} // Select all these tags with this class
  23. #id {stuff} // Select all tags with this id
  24. a#id {CSS} // Select <a> tag with this id.
  25. li:first-child {stuff} // Select only first li tag.
  26. h2 ~ p {stuff} // Select all P tags if they are siblings of H2
  27. div * p {CSS} // Select P if it is a granchild of DIV
  28. div + p {CSS} // Select P if it's an immediate sibling to DIV
  29. div ~ p {CSS} // Select P element that are preceded by DIV
  30.  
  31. - Pseudoselectors
  32. tag:hover {CSS}
  33. tag:after {content:' aftertest'} // Put ' aftertest' after all of these tags. See CSS entities.
  34.  
  35. - Matching selectors
  36. tag[attribute^="text"] = select if attribute begins with text
  37. tag[attribute$="text"] = select if attribute ends with text
  38. tag[att*="text"] = select if attribute matches text anywhere in attribute
  39. tag:not(s) = select tag that is not 's'
  40. tag:nth-child(n) = select nth child of this tag
  41. More pseudo classes: https://developer.mozilla.org/nl/docs/Web/CSS/Voor_Beginners/Selectors
  42. [ATTRIBUTE~="string"] = [title~="flower"] = select where <title> contains 'flower'
  43. [ATTRIBUTE="string"] = select all tags where ATTRIBUTE is exactly 'string'
  44.  
  45. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement