【发布时间】:2017-02-20 01:31:02
【问题描述】:
所以我对 flexbox 有点陌生,我试图把这个段落放在一个 flexed div 中,并让它有一个最小宽度,这样它就不会延伸到整个页面。但是,一旦我在 div 框上添加了一个最小宽度,它就会停止使我的内容居中超过移动宽度。我将在下面添加一个 sn-p,如果有人需要进一步澄清这个问题,请告诉我。感谢任何花时间审查此内容并为我提供建议的人!
#whoheading {
color: #10D0C9;
font-family: 'Philosopher', sans-serif;
display: flex;
align-content: center;
align-items: center;
align-self: center;
justify-content: center;
}
#description {
display: flex;
align-content: center;
align-items: center;
justify-content: center;
color: #BBBBBB;
margin: 15px;
}
@media only screen and (min-width: 760px) {
#smaller {
display: flex;
justify-content: center;
align-content: center;
align-self: center;
min-width: 200px;
max-width: 400px;
flex-basis: auto;
/* default value */
flex-grow: 1;
}
}
<div id="who">
<h3 id="whoheading">Who Am I?</h3>
<div id="smaller">
<p id="description">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It
has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop
publishing software like Aldus PageMaker including versions of Lorem Ipsum. </p>
</div>
<a href="contact.html" class="goals hover-fill" data-txthover="Hover Over Me">Contact me to achieve these goals</a>
<div class="keepOpen"></div>
</div>
【问题讨论】:
标签: html css flexbox centering