Skip to content

Instantly share code, notes, and snippets.

@oojikoo-gist
Created April 24, 2015 16:19
Show Gist options
  • Save oojikoo-gist/e789d474eaad48ef5a9c to your computer and use it in GitHub Desktop.
Save oojikoo-gist/e789d474eaad48ef5a9c to your computer and use it in GitHub Desktop.
rails: css_dictionary.css
// CSS dictionary
// <a href="#" rel="friend nofollow">Larry</a>
li a[rel~='friend'] {
font-weight: bold;
}
// target only #upperSection, #lowerSection
// <div id="upperSection">
// <p>Lorem ipsum dolor sit amet...</p>
// </div>
// <div id="somethingElse">
// <p>Lorem ipsum dolor sit amet...</p>
// </div>
// <div id="lowerSection">
// <p>Lorem ipsum dolor sit amet...</p>
// </div>
// <div id="footer">
// <p>Lorem ipsum dolor sit amet...</p>
// </div>
div[id*='Section'] {
color: red;
}
// target begin with or end with
// <ul>
// <li><a href="#" title="stooge one">Larry</a></li>
// <li><a href="#" title="the second stooge">Curly</a></li>
// <li><a href="#" title="stooge three">Moe</a></li>
// <li><a href="#" title="impostor">Curly-Joe</a></li>
// </ul>
li a[title^='stooge'] {
color: red
} /*Beginning*/
li a[title$='stooge'] {
color: yellow
} /*Ending*/
// Chaining Attribute Selectors
// <ul>
// <li><a href="#" title="stooge one">Larry</a></li>
// <li><a href="#" title="the second stooge">Curly</a></li>
// <li><a href="#" title="stooge three">Moe</a></li>
// <li><a href="#" title="the impostor">Curly-Joe</a></li>
// </ul>
li a[title*='stooge'][title^='the'] {color: red;}
// The Book of CSS3
// <div id="combinators">
// <p>Not this one.</p>
// <h1>Gibberish</h1>
// <p>Pick me!</p>
// <p>Lorem ipsum dolor sit amet...</p>
// <p>Lorem ipsum dolor sit amet...</p>
// <p>Lorem ipsum dolor sit amet...</p>
// </div>
h1 + p {color: orange;}
// all after h1
h1 ~ p {color: orange;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment