[英]How to move line of text below another?
I am having trouble moving one line of text below another. 我在将一行文字移动到另一行下方时遇到麻烦。 I have a feeling its something to do with the flexbox vertical align.
我觉得它与flexbox垂直对齐有关。 I have also tried using
display: block
but to no avail. 我也尝试过使用
display: block
但无济于事。 Please help, thank you. 请帮忙,谢谢。
The problem is the first section here: https://jsfiddle.net/sqeeux47/ 问题是这里的第一部分: https : //jsfiddle.net/sqeeux47/
HTML HTML
<section id="section1">
<h1 id="section1heading">Welcome to our multicultural society.</h1>
<h4 id="section1paragraph">Come worship with us.</h4>
</section>
CSS CSS
#section1 {
background-image: url(" http://i300.photobucket.com/...");
background-repeat:no-repeat;
background-size:100%;
background-position:center;
width:100%;
height:606px;
text-align:center;
display:flex;
align-items:center;
justify-content:center;
}
Add one line to the parent container: 在父容器中添加一行:
#section1 { flex-direction: column; }
OR 要么
#section1 { flex-wrap: wrap; }
When you create a flex container (by declaring display: flex
on an element), several default rules go into effect. 创建Flex容器时(通过在元素上声明
display: flex
),一些默认规则将生效。 Two of these rules are flex-direction: row
and flex-wrap: nowrap
. 其中两个规则是
flex-direction: row
和flex-wrap: nowrap
。
This means that flex items will align horizontally on a single line, which is the issue you are facing. 这意味着弹性项目将在一行上水平对齐,这是您面临的问题。
In order to alter this behavior, you could change the flex-direction
or allow flex items to wrap. 为了更改此行为,您可以更改
flex-direction
或允许弹性项目包装。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.