Skip to content

Class 与 Style 绑定

基本使用

jsx
import './App.css'

const App = () => {
  return (
    <div className="container">
      <h1 style={{ color: 'red', fontSize: '30px' }}>I'm red</h1>
      <button className="button">I'm a button</button>
    </div>
  )
}

export default App
css
.container {
  padding: 20px;
  background-color: lightblue;
}

.button {
  background-color: blue;
  color: white;
  padding: 10px 20px;
  border: none;
  cursor: pointer;
}

.button:hover {
  background-color: darkblue;
}

基于 MIT 许可发布