如何在 React 功能组件中为 HTML Body 添加样式。我已将其包含在 css 中。我看到其他 CSS 正在被应用。但缺少车身样式
body {
height: 100% ;
display:flex;
flex-direction:column;
justify-content: center;
}
最佳答案
您可以在public/index.html
中添加此样式
您还忘记在 css 中的 body 后面添加冒号。
索引.html
<!DOCTYPE html>
<html lang="en">
<head>
<style>
body:{
height: 100% ;
display:flex;
flex-direction:column;
justify-content: center;
}
</style>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
关于javascript - React 在 Body 上设置样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61606367/