Skip to content

Instantly share code, notes, and snippets.

@mikeyamadeo
Last active August 8, 2016 15:32
Show Gist options
  • Save mikeyamadeo/acda3503e0d2d73e0c97879a0af1bd58 to your computer and use it in GitHub Desktop.
Save mikeyamadeo/acda3503e0d2d73e0c97879a0af1bd58 to your computer and use it in GitHub Desktop.
.body > :last-child {
  margin-bottom: 0;
}

.theme-red .txt {
  color: red;
}

Purely using JS will require a shift in thinking. For example, let's say we want to apply a top margin to all the list items but one. Intead of:

.li:not(:first-child) {
  margin-top: .5em;
}

We would use JS to conditionally render margin:

<ul>
  {items.map((item, i) =>
    <li style={i > 0 ? {marginTop: '.5em'} : {}}>
      {item.name}
    </li>
  )}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment