我有两个并排的div,但似乎无法确定如何使它们响应。两个Side-by-Side Divs - 增加响应度
寻找正确的方框落在左边框下600px或更低,保持所有其他居中,我在divs内完成。
每个并排div分别具有class .div-seller-resources-left和.div-seller-resources-right。
我为每个文本框的高度已经使用600px的媒体屏幕,因此我将使用600作为此断点。
附加了它在普通尺寸浏览器中所做的照片,以及它在小屏幕上的样子。正如您所看到的,较小的屏幕恰好可以将所有内容放在一个页面上。
/* formats the seller-resources page */
.div-header-seller-resources{
font-size:30px;
line-height:32px;
margin-bottom:10px;
}
.div-detail-seller-resources{
font-size:20px;
line-height:22px;
margin-bottom:45px;
}
/*sets the height of the div so each text box is the same size no matter how much text*/
.seller-resources-height{
height: 125px;
}
/*main container of two side by side boxes*/
.div-main-container-seller-resources{
width:100%;
margin-top:30px;
text-align: center;
display: flex;
justify-content: center;
}
/*div under main container, containing both right and left seller resourcs */
.seller-resources-inner{
display: flex;
flex-direction:row;
}
/*margin here centeres all the content within the div*/
.div-seller-resources-left{
width: 300px;
display: flex;
text-align:center;
margin:0px auto;
}
/*margin here centeres all the content within the div*/
.div-seller-resources-right{
width: 350px;
display: flex;
text-align:center;
margin:0px auto;
}
/* sets the text box screens taller at smaller screens so they don't overlap */
@media screen and (max-width: 600px) {
.seller-resources-height{
height:200px;
}
}
@media screen and (max-width: 600px) {
div-seller-resources-left .div-seller-resources-left{
width:100%;
}
}
<div class="div-main-container-seller-resources">
<div class="seller-resources-inner">
<div class="div-seller-resources-left" style="display: inline-block;">
<div class="seller-resources-height">
<div class="div-header-seller-resources"><a href="https://yodega.com/how-yodega-works/">How Yodega Works</a></div>
<div class="div-detail-seller-resources">Learn about how Yodega works for sellers</div>
</div>
<div class="clear"></div>
<div class="seller-resources-height">
<div class="div-header-seller-resources"><a href="https://yodega.com/referrals/">Referrals</a></div>
<div class="div-detail-seller-resources">Refer another business to reduce your fees</div>
</div>
<div class="clear"></div>
<div class="seller-resources-height">
<div class="div-header-seller-resources"><a href="https://yodega.com/how-to-sell-with-yodega/">How to Sell with Yodega</a></div>
<div class="div-detail-seller-resources">Learn the best ways to promote your Yodega store</div>
</div>
<div class="clear"></div>
</div>
<div class="div-seller-resources-right" style="display: inline-block;">
<div class="seller-resources-height">
<div class="div-header-seller-resources"><a href="https://yodega.com/setting-up-your-store/">Setting Up Your Store</a></div>
<div class="div-detail-seller-resources">Detailed instructions on how to build your store</div>
</div>
<div class="clear"></div>
<div class="seller-resources-height">
<div class="div-header-seller-resources"><a href="https://yodega.com/advanced-product-shipping/">Advanced Shipping & Product Options</a></div>
<div class="div-detail-seller-resources">Variable Shipping Costs, Add Product Details and More</div>
</div>
<div class="clear"></div>
<div class="seller-resources-height">
<div class="div-header-seller-resources"><a href="https://yodega.com/order-management-seller-dashboard/">Order Management, Seller Dashboard & Payment</a></div>
<div class="div-detail-seller-resources">Detailed information on how to manage and fill orders and payments</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
您可以添加柔性包装:包装;进入媒体查询之外的.seller-resources-inner {},它应该可以工作,但是如果您想要更具体的话,请在媒体查询中尝试使用 –
您可以改进问题以描述您想要实现的内容。据我可以看到2个div是并排的。是不是希望2个并排div的标题占据相同数量的垂直空间? –
嗨马丁乔伊纳,他们看起来如何我喜欢全屏幕,但在较小的屏幕上,我想并排divs堆栈。 –