Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Created August 13, 2022 04:43
Show Gist options
  • Save SarahElson/80f9159debf107292ac12a82a9273187 to your computer and use it in GitHub Desktop.
Save SarahElson/80f9159debf107292ac12a82a9273187 to your computer and use it in GitHub Desktop.
How To Style And Write CSS In React
import "./styles.css";
export default function App() {
return (
<div className='App'>
<h1>
Hello World
<style jsx>
{`
h1 {
color: whitesmoke;
background: black;
}
.App {
background: orange;
}
h2 {
color: white;
}
img {
border-radius: 50%;
width: 250px;
height: 250px;
object-fit: contain;
}
img:hover {
object-fit: cover;
}
`}
</style>
</h1>
<h2>Wondering what’s even more challenging than choosing a JavaScript framework? You guessed it: choosing a CSS-in-JS solution. Why? Because there are more than 40 libraries out there, each of them offers a unique set of features.</h2>
<img
alt=''
src=https://cdn.statically.io/img/austingil.com/f=auto%2Cq=70/wp-content/uploads/JavaScript-Blog-Cover.png'
/>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment