Skip Navigation

[Resolved] Vertically align Multiple Lines in View

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to display several columns of content. One of the columns contains a multiline custom field. The top of the text is not aligned with the text in the 3 other columns.

Solution: You can add some CSS to modify this paragraph's spacing. Add this in your Loop Editor's CSS panel:

.no-top-margin-p p {
    margin-top: 0;
}

Then add the no-top-margin-p class to the column that contains the WYSIWYG field:

<div class="row">
<div class="col-sm-3">[types field='test-single-line' item='$current_page'][/types]</div>
<div class="col-sm-3 no-top-margin-p">[types field='test-multiple-lines' item='$current_page'][/types]</div>
<div class="col-sm-3">[types field='test-url' title='Link' target='_blank' item='$current_page'][/types]</div>
<div class="col-sm-3">[types field='test-date' style='text' format='d F Y' item='$current_page'][/types]</div>
</div>

Relevant Documentation:
https://toolset.com/documentation/user-guides/adding-custom-css-views/

This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 6 replies, has 2 voices.

Last updated by Ben 5 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1160799

Ben
View.png

I am trying to vertically align the output of a Multiple Lines CF with all the other fields outputted in this View. See screenshot for the output I get at the moment.

I am using this in the Loop Editor:

	<div class="row">
	<div class="col-sm-3">[types field='test-single-line' item='$current_page'][/types]</div>
	<div class="col-sm-3">[types field='test-multiple-lines' item='$current_page'][/types]</div>
	<div class="col-sm-3">[types field='test-url' title='Link' target='_blank' item='$current_page'][/types]</div>
	<div class="col-sm-3">[types field='test-date' style='text' format='d F Y' item='$current_page'][/types]</div>
	</div>

And this in the CSS Editor:

col-sm-3 		{vertical-align: top;
}
col-sm-3	p	{vertical-align: top;
}

I cannot see why this isn't work? Can you help?!

#1160893

Hi, there's no one correct answer for everyone here because each theme and plugin can have different effects on text layout. I might be able to make a suggestion if I can see it in a browser. Please provide login credentials in the private reply fields here and let me know where I can find this on your site.

#1162455

The WYSIWYG field is automatically output in a paragraph tag, while the other fields are not. Paragraph tags have a bit of top padding in your theme, so the easiest way to line these items up is to wrap the other custom field shortcodes in paragraph tag s:

<div class="row">
<div class="col-sm-3"><p>[types field='test-single-line' item='$current_page'][/types]</p></div>
<div class="col-sm-3">[types field='test-multiple-lines' item='$current_page'][/types]</div>
<div class="col-sm-3"><p>[types field='test-url' title='Link' target='_blank' item='$current_page'][/types]</p></div>
<div class="col-sm-3"><p>[types field='test-date' style='text' format='d F Y' item='$current_page'][/types]</p></div>
</div>

This will make the top spacing more consistent in each column.

#1162466

Ben

Thank you for your reply Christian.

It works well. Sorry to be a pain, but is there a way I can shrink this padding around the paragraph instead?

Where I am going to be using it, the text is going to need to be as close as possible with a very small amount of padding.

#1162467

Ben

Could you also please delete the screenshot on Reply #1162455 please.

#1162494

Of course, the screenshot has been deleted. You can add some CSS to modify this paragraph's spacing. Add this in your Loop Editor's CSS panel:

.no-top-margin-p p {
    margin-top: 0;
}

Then add the no-top-margin-p class to the column that contains the WYSIWYG field:

<div class="row">
<div class="col-sm-3">[types field='test-single-line' item='$current_page'][/types]</div>
<div class="col-sm-3 no-top-margin-p">[types field='test-multiple-lines' item='$current_page'][/types]</div>
<div class="col-sm-3">[types field='test-url' title='Link' target='_blank' item='$current_page'][/types]</div>
<div class="col-sm-3">[types field='test-date' style='text' format='d F Y' item='$current_page'][/types]</div>
</div>
#1162984

Ben

That has worked like a dream!

Thank you very very much for all your help with this ticket. It's appreciated!