Cakers
Cakers

Reputation: 655

equal width columns possibly with flexbox

So currently I am trying to have my columns have equal height because they are each just a little bit off. Is there a way to do this with flexbox? I'm not very familiar with flexbox however, so if any of you have any advice please let me know! Thank you!

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

}

#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{
  display:inline-block;
	text-decoration: none;
	
}

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

.content{
	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>

Upvotes: 0

Views: 177

Answers (2)

Tobias Glaus
Tobias Glaus

Reputation: 3628

This is right what you need.
Aso the previous answer mentioned, you have to put every div, section, whatever you use, inside a div.
Then you give that parent div the property display: flex. And if you want all your child elements to have the same width, you can use flex: 1 or flex-grow: 1

If you want to try out, whatelse you can do with flexbox, try this out. That's a nice playground where you can play with the values and see what happens. I hope this helps :)

Upvotes: 1

Eric Guan
Eric Guan

Reputation: 15992

First move <h2 id="recent"> Most Recent Work</h2> outside of #recentwork so your flex items are just .parentdiv.

Then add display:flex to #recentwork.

This will give your columns equal height.

Adding flex:1 to .parentdiv will give your columns equal width.

Upvotes: 1

Related Questions