javascript - Text align isn't working when getting text from data attribute on object tag
问题描述
So my html code is structure like this.
<div className="App">
<header className="App-header">
<Container fileType={this.state.currentFileType} file= this.state.currentFile} />
<Board handleClick={() => this.handleClick()} />
</header>
</div>
and this is my Container div which contains the text. Data just calls a basic .txt file two sentences long.
<div className="NoteContainer">
<object data={"/Notes/" + props.file} />
</div>
My css looks like this
.App{
text-align: center;
background-color: #a461f2;
}
.App-header {
height: 100vh;
width: 100vw;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}
.NoteContainer {
padding:40px;
display: flex;
text-align: center;
}
For some reason I can't get the text coming from note1.txt to center. Any help would be greatly appreciated.
解决方案
text-align is for Text. you can try:
align-items: center;
justify-content: center;
align-content: center;
推荐阅读
- javascript - 新手:将对象数组快速传递给哈巴狗
- command-line - TFVC 如何获取带有行号的作者(注释)?
- php - 我的 Laravel 8 Auth 在 XAMPP 本地服务器上运行良好,但是当托管在 cPanel 上时,它没有通过身份验证,而是在登录时,显示页面已过期
- javascript - 使用 jQuery 以编程方式在上传按钮中设置文件名
- javascript - MP3 文件不在自定义控件中播放
- javascript - Sequelize查找多个表
- video - 如何使用静音 = 0 自动播放 Vimeo 视频?
- firebase - FirestoreRecyclerAdapter 显示 Nothong
- c# - 隐藏在软键盘 UWP 后面的 ContentDialog
- node.js - npm 命令给出语法错误:意外令牌(mac)