Skip to main content
Inspiring
Jun 29, 2017 8:07 AM UTC
Answered

Equal text line length inside a bootstrap thumbnail.

Hi,

I have several thumbnail and I want to set the same text line width to all of them.

The basic thumnal structure loks like this:

<div id="prouctsThumbs" class="row">

        <article class="col-xs-4 col-sm-4 col-md-3">

          <div class="thumbnail"><a href="#" class="thumbnail"><img src="../../_images/products/thumbs/thumb1.jpg"  alt=""/></a>

            <p>text lenght 1</p>

          </div>

        </article>

        <article class="col-xs-4 col-sm-4 col-md-3">

          <div class="thumbnail"><a href="#" class="thumbnail"><img src="../../_images/products/thumbs/thumb2.jpg" alt=""/></a>

            <p>text length 2 which is longer</p>

          </div>

        </article>

If not, than in xs devices the text line, which is different for each thumbnail, may causes element missplacement as seen below.

I am trying to make an equal text line width.

I'd rather not use media queries for the <p> heigh becasue this differes for each size.

If i could make all text paragraphs equal and wrap inside its parent element that it would solve this.

Or any other way.

I do not use bootstrap 4.

Thank you,

This topic is closed to new replies. Start a new post to keep the conversation going.
BenPleysier
BenPleysierCorrect answer
Community Expert
Jun 29, 2017 10:16 AM UTC

Try adding the following to your stylesheet

#prouctsThumbs .col-xs-4:nth-child(3n+1), #prouctsThumbs .col-sm-4:nth-child(3n+1), #prouctsThumbs .col-md-3:nth-child(4n+1) {

clear: left !important;

}

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!

2 replies

Legend
Jun 29, 2017 10:52 AM UTC

karpiyon  wrote

I do not use bootstrap 4.

Bootstrap 4 will give you the option of using Flexbox - clearing columns of differing depths will then be easy, you won't need any extra css or hacks.

Translate
BenPleysier
Community Expert
BenPleysierCommunity ExpertCorrect answer
Community Expert
Jun 29, 2017 10:16 AM UTC

Try adding the following to your stylesheet

#prouctsThumbs .col-xs-4:nth-child(3n+1), #prouctsThumbs .col-sm-4:nth-child(3n+1), #prouctsThumbs .col-md-3:nth-child(4n+1) {

clear: left !important;

}

Translate
Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!