2017-02-23 29 views
1

フレックスボックスは本当に新しく、最終的にデスクトップブラウザにアイテムを表示させることができました。しかし、タブレット/モバイルビューではコンテンツが重複しているので、縦に並べて1つの列に重ねて反応させる方法を見つけようとしていました。私はこれがメディアクエリで行われていることを知っているが、私はちょうどどのコードを使うべきか知っている。誰かがこれについてのアドバイスがあれば、大いに感謝します!ありがとうございました!フレックスボックスの内容が重複しています

#recentwork { 
 
    background-color: #1DA0A3; 
 
    margin-left: auto; 
 
    margin-right: auto; 
 
    text-align: center; 
 
    text-decoration: none; 
 
    display: flex; 
 
    flex-wrap: wrap; 
 
    flex-direction: row; 
 
    justify-content: flex-start; 
 
    align-items: stretch; 
 
} 
 

 
@media screen and (min-width:600px) { 
 
    #recentwork { 
 
     flex-wrap: nowrap; 
 
    } 
 
} 
 

 
#recentwork a { 
 
    text-decoration: none; 
 
} 
 

 
#recent { 
 
    padding: 20px; 
 
    text-decoration: none; 
 
} 
 

 
#recentwork img { 
 
    padding: 20px; 
 
    width: 200px; 
 
    height: 200px; 
 
} 
 

 
.more { 
 
    text-decoration: none; 
 
    color: black; 
 
} 
 

 
.more:hover { 
 
    color: white; 
 
} 
 

 
.titles { 
 
    text-decoration: none; 
 
    font-size: 20px; 
 
    color: black; 
 

 
} 
 

 
.parentdiv { 
 
    text-decoration: none; 
 
    flex: 1; 
 
    justify-content: space-between; 
 
} 
 

 
@media only screen and (min-width: 760px) { 
 
    #recentwork img { 
 
     width: 300px; 
 
     height: 300px; 
 
     text-decoration: none; 
 
    } 
 
} 
 

 
.content { 
 
    width: 400px; 
 
} 
 

 
@media only screen and (min-width: 760px) { 
 
    #recentwork img { 
 
     width: 300px; 
 
     height: 300px; 
 
    } 
 

 
    #recent{ 
 
     font-size: 50px; 
 
     padding: 40px; 
 
    } 
 
}
<section id="skills"> 
 
    <h2 id="recent">Most Recent Work</h2> 
 
    <div id="recentwork"> 
 
     <div class="parentdiv"> 
 
      <a href="https://media.flaticon.com/img/tumble.svg" data-lightbox="website" data-title=""> 
 
       <img src="https://media.flaticon.com/img/tumble.svg" width="200px" height="200px"> 
 
       <div class="underline"> 
 
        <h3 class="titles"> Web Design</h3></div> 
 
      </a> 
 
      <p class="content">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.</p> 
 
      <a href="" class="more"><h3>See More</h3></a> 
 
     </div> 
 
     <div class="parentdiv"> 
 
      <a href="https://media.flaticon.com/img/tumble.svg" data-lightbox="website" data-title=""> 
 
       <img src="https://media.flaticon.com/img/tumble.svg" width="200px" height="200px"> 
 
       <h3 class="titles"> Photography</h3> 
 
      </a> 
 
      <p class="content">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> 
 
      <a href="" class="more"><h3>See More</h3></a> 
 
     </div> 
 
     <div class="parentdiv"> 
 
      <a href="https://media.flaticon.com/img/tumble.svg" data-lightbox="website" data-title=""> 
 
       <img src="https://media.flaticon.com/img/tumble.svg" width="200px" height="200px"> 
 
       <h3 class="titles"> Print</h3> 
 
      </a> 
 
      <p class="content">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> 
 
      <a href="" class="more"><h3> See More</h3></a> 
 
     </div> 
 
     <div class="parentdiv"> 
 
      <a href="https://media.flaticon.com/img/tumble.svg" data-lightbox="website" data-title=""> 
 
       <img src="https://media.flaticon.com/img/tumble.svg" width="200px" height="200px"> 
 
       <h3 class="titles"> Logos</h3> 
 
      </a> 
 
      <p class="content">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> 
 
      <a href="" class="more"><h3 > See More</h3></a> 
 
     </div> 
 
    </div> 
 
</section>

答えて

3

しよう:flex-wrap: nowrapを削除
1.(flex-wrapについての詳細を読みます)。
2. width: 400px.content要素から.parentdiv要素のflexプロパティに移動します。
3. #recentwork要素にjustify-content: centerを設定します。

#recentwork { 
 
    background-color: #1DA0A3; 
 
    margin-left: auto; 
 
    margin-right: auto; 
 
    text-align: center; 
 
    text-decoration: none; 
 
    display: flex; 
 
    flex-wrap: wrap; 
 
    flex-direction: row; 
 
    justify-content: center; 
 
    align-items: stretch; 
 
} 
 

 
#recentwork a { 
 
    text-decoration:none; 
 
} 
 

 
#recent { 
 
    padding: 20px; 
 
    text-decoration: none; 
 
} 
 
#recentwork img { 
 
    padding: 20px; 
 
    width: 200px; 
 
    height: 200px; 
 
} 
 

 
.more { 
 
    text-decoration: none; 
 
    color: black; 
 
} 
 

 
.more:hover { 
 
    color: white; 
 
} 
 

 
.titles { 
 
    text-decoration: none; 
 
    font-size: 20px; 
 
    color: black; 
 
} 
 

 
.parentdiv { 
 
    max-width: 100%; 
 
    text-decoration: none; 
 
    flex: 0 1 400px; 
 
    justify-content: space-between; 
 
} 
 

 
@media only screen and (min-width: 760px) { 
 
    #recentwork img { 
 
     width: 300px; 
 
     height: 300px; 
 
     text-decoration:none; 
 
    } 
 
} 
 

 
@media only screen and (min-width: 760px) { 
 
    #recentwork img{ 
 
     width: 300px; 
 
     height: 300px; 
 
    } 
 

 
    #recent{ 
 
     font-size: 50px; 
 
     padding: 40px; 
 
    } 
 
}
<section id="skills"> 
 
    <h2 id="recent">Most Recent Work</h2> 
 
    <div id="recentwork"> 
 
     <div class="parentdiv"> 
 
      <a href="https://media.flaticon.com/img/tumble.svg" data-lightbox="website" data-title=""> 
 
       <img src="https://media.flaticon.com/img/tumble.svg" width="200px" height="200px"> 
 
       <div class="underline"> 
 
        <h3 class="titles"> Web Design</h3> 
 
       </div> 
 
      </a> 
 
      <p class="content">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. </p> 
 

 
      <a href="" class="more"><h3 > See More</h3></a> 
 
     </div> 
 
     <div class="parentdiv"> 
 
      <a href="https://media.flaticon.com/img/tumble.svg" data-lightbox="website" data-title=""> 
 
       <img src="https://media.flaticon.com/img/tumble.svg" width="200px" height="200px"> 
 
       <h3 class="titles"> Photography</h3> 
 
      </a> 
 
      <p class="content">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> 
 
      <a href="" class="more"><h3 > See More</h3></a> 
 
     </div> 
 
     <div class="parentdiv"> 
 
      <a href="https://media.flaticon.com/img/tumble.svg" data-lightbox="website" data-title=""> 
 
       <img src="https://media.flaticon.com/img/tumble.svg" width="200px" height="200px"> 
 
       <h3 class="titles"> Print</h3> 
 
      </a> 
 
      <p class="content">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> 
 
      <a href="" class="more"><h3 > See More</h3></a> 
 
     </div> 
 

 
     <div class="parentdiv"> 
 
      <a href="https://media.flaticon.com/img/tumble.svg" data-lightbox="website" data-title=""> 
 
       <img src="https://media.flaticon.com/img/tumble.svg" width="200px" height="200px"> 
 
       <h3 class="titles"> Logos</h3> 
 
      </a> 
 
      <p class="content">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> 
 
      <a href="" class="more"><h3 > See More</h3></a> 
 
     </div> 
 
    </div> 
 
</section>

関連する問題