2017-08-29 7 views
0

私は2つのサイドバイサイドdivを持っていますが、どのようにレスポンスにするかわかりません。2つのサイドバイサイドディビジョン - 応答性の追加

右のボックスを左のボックスの下に600pxまたはそれ以下になるように探し、div内で行った他のセンタリングをすべて維持します。

各サイドバイサイドdivには、それぞれ.div-seller-resources-leftと.div-seller-resources-rightというクラスがあります。

すでに600pxのメディア画面を各テキストボックスの高さに使用していますので、600をブレークポイントとして使用します。

通常のサイズのブラウザでは何が行われているのか、小さい画面ではどのように見えるのかを添付してください。ご存知のように、小さな画面は、すべてのコンテンツを1つのページに収めることができれば最高です。

enter image description here

enter image description here

/* 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 &amp; 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 &amp; 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>

+0

あなたはフレックスラップを追加することができますラップ。メディアクエリの外側の.seller-resources-inner {}に入れてください。それはうまくいくはずですが、もっと具体的にしたい場合は、メディアクエリの中で試してみてください。 –

+0

達成したいことを説明するために質問を改善できますか?私が見る限り、2つの部門が並んでいます。 2つのサイドバイサイドディビジョンのタイトルが同じ量の垂直スペースを占有したいと思っていますか? –

+0

こんにちはMartin Joiner、彼らは私が全画面で好きなように見えますが、小さな画面ではサイドバイサイドのdivを積み重ねたいと思います。 –

答えて

1

私はflex-wrapプロパティを使用することをお勧めします。この場合、要素を強制的に1つの列にすることができます。 (MDN Docsを参照してください)

.seller-resources-innerクラスにflex-wrap: wrap;を適用してください(下記のスニペットを参照)。

/* 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; 
 
    } 
 
    .seller-resources-inner { 
 
    flex-wrap: wrap; 
 
    } 
 
} 
 

 
@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 &amp; 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 &amp; 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>

+0

Ramizさん、ありがとう!それは正しい道をたどっているようだ。しかし、彼らはまだ小さな画面に並べて(スタックしないで)座っています。多分、divがスタックをトリガしないように十分に小さなサイズに縮小することができるからでしょうか?ライブを見るにはhttp://yodega.com/seller-resourcesにアクセスしてください。 –

+0

@JacobJordan Um、問題は間違ったセレクターだと思います。 '600px'のメディアクエリの中で' .div-main-container-seller-resources'に 'flex-wrap:wrap'を適用してみてください(私はライブでチェックしました)。 –

+1

ありがとうございました!いくつかの少し高さの微調整と今は素晴らしいです。どうもありがとう!! –

関連する問題