html - 如何在 CSS 中将文本列居中

标签 html css text alignment center

在一个小型(初学者)元素中,我有两个文本栏,而且我和 friend 正在努力。这是我们的代码。

h3 {
text-align: left;
font-family: Times;
display:flex;
align-items:center;
}



.AboutBA {
text-align: justify;
width: 400px;
height: 300px;
position: relative;
left: 190px;

}

.Position {
text-align: justify;
width: 400px;
height: 300px;
position: relative;
left: 650px;
bottom: 319px;
}

我不想更改太多,以免破坏布局,我唯一需要的是将两个文本列居中,使它们位于上图下方。

Here is how the code looks as of now.

最佳答案

    .textDiv {
        width: 100%;
        background-color: #CDD0E1;
        position: absolute;
        bottom: 0;
        right: 0;
        display: table;
        height:200px;
    }

        .textDiv div {
            float: left;
            width: 35%;
            padding:10px 5% 20px;
            display: inline-table;
        }
  .textDiv div span {
                 text-align: justify;
                  font-size: 13px;
            }
            .textDiv div strong {
                font-size: 16px;
                line-height: 40px;
                text-align: left !important;
            }
<div class="textDiv">
  <div>
     <strong>  teacher empowers kids</strong>
     <br />
     <span>Chris Ulmer, 28, reflects on the decision to leave his teaching career in order to focus on a worldwide mission.
     </span>
  </div>
  <div>
     <strong> How he found his calling</strong>
     <br />
     <span> Ulmer, originally from Philadelphia, attended Penn State where he majored in media effects, or “the way social media affects those who take it in,” he explains.
     </span>
   </div>
</div>

关于html - 如何在 CSS 中将文本列居中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45445012/

相关文章:

html - 将 div 直接放在父 div 之上

javascript - Angular JS 简单 API : only showing data that begins with the word 'request'

python - 如何知道哪个表单提交到flask web服务器

text - HTML 中的标签列表 - 纯逗号分隔列表或带有一些 css 的 ul?

c++ - Qt/QML : Text with inline QML elements

javascript - 类名从 Angular.js 中的 JSON 对象动态更改

javascript - 在 img 区域选择中,我想在新的 div 中显示选定的图像

javascript - 为 3 <img> 的水平行创建透明覆盖

javascript - jquery滑动动画

Regex 在 Regex101 上工作但不在 Powershell 中