reactjs - 为什么 textAlign 或 align 在 reactjs 中不起作用?
问题描述
我已经尝试通过我的 App.css 文件来完成它,然后我尝试了内联样式,但它仍然不会对齐屏幕中心的按钮。
import React, { Component } from 'react';
import './App.css'
class Body extends Component {
btn = {
}
render() {
return (
<div>
<button style={{textAlign:'center'}}>Get Started</button>
</div>
);
}
}
export default Body;
解决方案
我遇到了一个类似的问题,当使用 'semantic-ui-react' Header 组件时,内联样式不起作用。但是在将 Header 组件包装在 a 中并在textAlign: 'center'
其上应用样式之后,它就起作用了。
推荐阅读
- python-3.x - python3希腊字母未正确显示
- python - 如何解密最初使用 Fernet 加密的不同服务上的值?
- python - 在 3D 数组中查找最大值时间
- python - 如何动态循环值以过滤熊猫数据框?
- oracle - 如何在 Oracle 中将 UTF-16 符号代码转换为 nvarchar2?
- r - R:新变量,其值来自另一个变量,基于第三个变量中的最小值,按 ID 分组
- ruby - cron 作业在 shell 脚本中的 ruby 问题
- php - 将 Contact form 7 变量传递到屏幕
- java - 有没有办法旋转由像素值的二维数组表示的图像?
- c - 如何使用特定于级别的宏获取自定义日志记录功能以处理格式化打印