Skip to content

Instantly share code, notes, and snippets.

@lcoenen
Last active March 1, 2019 18:45
Show Gist options
  • Save lcoenen/6f0af78677ff1bdc2234e21e2e3108d4 to your computer and use it in GitHub Desktop.
Save lcoenen/6f0af78677ff1bdc2234e21e2e3108d4 to your computer and use it in GitHub Desktop.

How to use CSS on Github

JSX is the language we use in React. This is NOT HTML, albeit it is similar, but they are rules to respect when it comes to CSS:

  1. To link a class to a tag, use the following synthax:

    <tag className={css.theClassYouWantToUse}>

  2. NEVER use inline styling

    <tag style="text-width: 33px">NO! WRONG!</tag>

  3. Use camelCase to capitalise classname

    <tag classname={css.big-title}>ERROR! YOU SHOULD USE "bigTitle"</tag>

  4. To add several classes:

    `<tag className={[css.className1, css.className2, css.className3]}>

  5. If really needed, here's the format for inline styling (not recommanded)

    <tag style={background-image: "url('iejafiofea')"}>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment