我有一個通過彈出框顯示的部分。這個效果很好,但是當視口達到640像素或更小的尺寸時,我希望能夠以100%的寬度以display: block
時尚顯示所有三個部分。我嘗試將#contact-section
更改爲display: block
,但它完全超出了我的格式flex
。更改flexbox佈局以顯示塊格式
我希望它在640px的下面顯示。
有誰知道我怎麼能做到這一點不失彈性的格式,或者至少使得它在這個視工作?
Here is a fiddle which will allow the sections to be seen in a 640 or less viewport.
#contact-section {
\t display: flex;
\t justify-content: space-around;
\t align-items: center;
\t color: #FFF;
\t background: #00a16d;
\t padding: 1em;
}
#contact-section:before {
\t content: "";
\t flex: 0 0 1px;
\t height: 3em;
\t background: #FFF;
\t order: 2;
}
#contact-section-left {
\t font-size: 1.5em;
\t order: 1;
\t font-style: italic;
}
#contact-section-right {
\t background: url("../icons/envelope.png") center/contain no-repeat;
\t font-size: 2em;
\t order: 3;
\t padding: 1em 0;
}
#contact-section-right a {
\t color: #FFF;
\t text-decoration: none;
}
/*--------------------------MEDIA QUERY 640------------------------------------*/
@media screen and (max-width:640px) {
#contact-section {
\t display: flex;
\t justify-content: space-around;
\t align-items: center;
\t padding: 1em 2em;
}
#contact-section:before {
\t flex: 0 0 1px;
\t height: 3em;
\t order: 2;
display: block;
width: 100%;
}
#contact-section-left {
\t font-size: 1.5em;
\t order: 1;
display: block;
width: 100%;
}
#contact-section-right {
\t font-size: 2em;
\t order: 3;
\t padding: 1em 0;
display: block;
width: 100%;
}
\t
}
<div id="contact-section">
\t \t <div id="contact-section-left">Tell us more about your digital marketing project.</div>
\t \t <div id="contact-section-right"><a href="../discuss-project">Contact us</a></div>
\t </div>
謝謝。無論如何,我可以將「聯繫我們」放在圖片中央?現在圖像居中,但聯繫我們左對齊。 – Paul
另外,無論如何獲得'order:2';僞白線出現? – Paul
這不是真正的聯繫我們不對齊,它是一個內部。添加文本對齊:中心到部分 - 右側,現在它居中。至少在Chrome中,僞顯示...我將檢查FF和IE – vals