Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Div re-sizing when Child paragraph element re-sizes.

content: removed

3 Answers

Michael,

Based on my experimentation, the gallery-div text paragraphs cause the alignment problem. They need a consistent size like height: 33%;.

To validate, place the same amount of text in each paragraph. If you make all the text boxes with equal text the "gallery-divs" will align.

.gallery-div-par {
      height: 33%;
}
<p class="gallery-div-par">  text............ </p>

You might want to make the text box even more static by setting the height to some multiple of the line height in "em".

gallery-div-par {
  line-height: 1.5em;
  height: 4.5em;  /* three lines */
   overflow: hidden;
}

Give it a try,

Bob

Hi Bob, unfortunately that didn't work. I've read that a fixed value has to be set somewhere but at the moment its over my head what to look for if that is the pursuit not sure of course.

thank you for your help.

Hi Michael, I added a div to your html <div class="gallery-text">, in each gallery-div, around the title and description.

 <div class="gallery-text">
              <p class="para-title">Marketing Page</p>
              <p>This project shows the front page of a marketing website meant for a specific business I'm interested in.</p>
              </div>

In the responsive.css, I added this:
(forgot to add in vertical align in my original answer)

 .gallery-div {
    width: 45%;
    min-height: 10vmin; 
    position: relative; 
    display: inline-block;
    vertical-align: top;
    margin: 0 0 2%; 
  }
.gallery-text {
    padding-bottom: 1em;
  }

The vertical-align will make it so that you don't need to worry about the exact amount of text in descriptions.

Hope this helps!

Michael,

It applies to the title paragraph as well. A real fix may include altering the font-size in the title paragraph. You might relegate the title size two( 2 ), lines or twice the line height.

It seems to be working for me using the line height approach.

By the way, I like your layout.

Bob

Yes!! The code you have with your first reply works, I just somehow only saw applying a height of 33% as the answer not the line height application. Thank you. Now I will study it for a bit and see what you have done here.

Thank you for your help.