2017-02-23 34 views
0

Так что в настоящее время я пытаюсь, чтобы мои столбцы имели равную высоту, потому что они все немного отброшены. Есть ли способ сделать это с помощью flexbox? Я не очень хорошо знаком с flexbox, поэтому, если у кого-нибудь из вас есть какие-либо советы, пожалуйста, дайте мне знать! Спасибо!равные ширины столбцов, возможно, с flexbox

#recentwork { 
 
    background-color: #1DA0A3; 
 
    margin-left: auto; 
 
    margin-right: auto; 
 
    text-align: center; 
 
\t text-decoration: none; 
 
\t 
 

 
} 
 

 
#recentwork a{ 
 
\t text-decoration:none; 
 
} 
 

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

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

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

 
.more:hover{ 
 
\t color:white; 
 
} 
 

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

 
.parentdiv{ 
 
    display:inline-block; 
 
\t text-decoration: none; 
 
\t 
 
} 
 

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

 
.content{ 
 
\t width: 400px; 
 
}
<section id="skills"> 
 
<div id="recentwork"> 
 
    <h2 id="recent"> Most Recent Work</h2> 
 

 

 
<div class="parentdiv"> 
 
<a href="http://4vector.com/thumb_data/v4l-125260.jpg" data-lightbox="website" data-title=""> 
 
<img src="http://4vector.com/thumb_data/v4l-125260.jpg" width="200px" height="200px"> 
 
<div class="underline"> 
 
<h3 class="titles"> Web Design</h3></div> 
 
</a> 
 

 
<p class="content">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="http://4vector.com/thumb_data/v4l-125260.jpg" data-lightbox="website" data-title=""> 
 
<img src="http://4vector.com/thumb_data/v4l-125260.jpg" width="200px" height="200px"> 
 
<h3 class="titles"> Photography</h3> 
 
</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 </p> 
 

 
<a href="" class="more"><h3 > See More</h3></a> 
 
</div> 
 

 
    
 
    <div class="parentdiv"> 
 
<a href="http://4vector.com/thumb_data/v4l-125260.jpg" data-lightbox="website" data-title=""> 
 
<img src="http://4vector.com/thumb_data/v4l-125260.jpg" width="200px" height="200px"> 
 
<h3 class="titles"> Print</h3> 
 
</a> 
 
<p class="content">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> 
 

 
<a href="" class="more"><h3 > See More</h3></a> 
 
</div> 
 

 
    <div class="parentdiv"> 
 
<a href="http://4vector.com/thumb_data/v4l-125260.jpg" data-lightbox="website" data-title=""> 
 
<img src="http://4vector.com/thumb_data/v4l-125260.jpg" width="200px" height="200px"> 
 
<h3 class="titles"> Logos</h3> 
 
</a> 
 

 
<p class="content">printer took a galley of type and scrambled it to make a type specimen book. It has survived </p> 
 
<a href="" class="more"><h3 > See More</h3></a> 
 
</div> 
 
    
 

 
</div> 
 
</section>

ответ

1

This Правильно, что вам нужно.
А также упомянутый выше ответ, вы должны поставить все div, section, что бы вы ни использовали, внутри div.
Затем вы даете этому родительскому div свойство display: flex. И если вы хотите, чтобы все ваши дочерние элементы имели одинаковую ширину, вы можете использовать flex: 1 или flex-grow: 1

Если вы хотите опробовать, что вы можете сделать с помощью flexbox, попробуйте this. Это хорошая игровая площадка, где вы можете играть со значениями и видеть, что происходит. Надеюсь, это поможет :)

1

Первый ход <h2 id="recent"> Most Recent Work</h2> вне #recentwork поэтому ваши детали гибкого трубопровода только .parentdiv.

Затем добавьте display:flex в #recentwork.

Это придаст вашим колоннам равную высоту.

Добавление flex:1 в .parentdiv придаст вашим колонам равную ширину.