react基础样式控制

行内样式
html 复制代码
<div style={{width:'500px', height:'300px',background:'#ccc',margin:'200px auto'}}>文本</div>
class类名

注意:在react中使用class类名必须使用className

在外部src下新建index.css文件写入你的样式
javascript 复制代码
.fontcolor{
    color:red
}
在用到的页面引入使用
html 复制代码
import './index.css' //引入


//使用  className
<button className='fontcolor'>修改{user.name}</button>
相关推荐
小飞侠在吗1 天前
vue props
前端·javascript·vue.js
DsirNg1 天前
页面栈溢出问题修复总结
前端·微信小程序
小徐_23331 天前
uni-app 也能远程调试?使用 PageSpy 打开调试的新大门!
前端·微信小程序·uni-app
大怪v1 天前
【Virtual World 03】上帝之手
前端·javascript
招来红月1 天前
记录JS 实用API
javascript
别叫我->学废了->lol在线等1 天前
演示 hasattr 和 ** 解包操作符
开发语言·前端·python
霍夫曼1 天前
UTC时间与本地时间转换问题
java·linux·服务器·前端·javascript
DARLING Zero two♡1 天前
浏览器里跑 AI 语音转写?Whisper Web + cpolar让本地服务跑遍全网
前端·人工智能·whisper
꒰ঌ小武໒꒱1 天前
文件上传全维度知识体系:从基础原理到高级优化
javascript·node.js
Lovely Ruby1 天前
前端er Go-Frame 的学习笔记:实现 to-do 功能(三),用 docker 封装成镜像,并且同时启动前后端数据库服务
前端·学习·golang