The power to vertically align content material when development a website online with Divi could be a handy addition in your design device belt. Now and again a definite format requires content material to be vertically aligned in numerous techniques (targeted, backside, best). The most typical want is to have your content material vertically targeted. It supplies a satisfying contact of symmetrical spacing that in reality turns out to be useful when the use of more than one column layouts on your content material. Plus, vertically targeted content material remains targeted on other browser widths, which takes the grunt determine of making use of customized padding or margins to get identical responsiveness.

On this instructional, I’m going to turn you ways you’ll upload a couple of small snippets of CSS to any column to vertically align the content material. I’ll be the use of a few of Divi’s premade layouts for examples of ways to do that. Should you don’t know a lot about CSS, you don’t have to fret. This can be simple sufficient to use in your personal layouts in seconds.

Figuring out Flex and Divi

The Flex (or Flexbox) css assets is just some way for positioning components in horizontal and/or vertical stacks (roughly like a desk). With the exception of, not like conventional tables, the flex assets means that you can create packing containers that modify or “flex” to the scale of the content material it holds.

Divi does use the flex assets every time you choose “Equalize Column Heights” as your row environment. This merely makes positive the scale of your columns will all modify to the scale of the column with essentially the most content material. And because “Equalize Column Heights” turns on the flex for the row container, you’ll simply benefit from that by way of including css in your columns to regulate the contents of each and every column (or field).

For instance, in case you upload “margin: auto” to any column in a row, the content material of that column (whether or not it’s a number of modules) will transform vertically targeted.

Additionally, in case you upload “align-items:heart;” in your row, all your columns (and their content material) can be vertically targeted.

In fact, there are lots of extra makes use of for the flex assets in internet design at the side of extra complicated CSS that you’ll practice in your theme. However for this instructional, I sought after to stay issues easy.

Is This Actually Important?

Technically, no. You’ll be able to vertically align your content material/modules inside a column the use of customized spacing (padding and margin). For instance, you’ll use Divi’s spacing choices to offer a column equivalent best and backside padding to heart the module(s) vertically inside the column. Or, you’ll upload best best padding to a column to make the content material backside aligned. Alternatively, you could have to regulate the spacing when updating your web page with extra content material. Plus, it can be tricky to stay this alignment on other browser widths.

So, if you’re on the lookout for a way to vertically aligning content material with no need to consider customized spacing, I feel you are going to to find this convenient.

Let’s get began!

Load the Premade Structure to Your Web page

To kick issues off, I’m going to make use of the Inside Design Corporate Portfolio Web page Structure. To get this format for your web page, create a brand new web page. Then give your web page a name. Click on “Use Divi Builder” after which “Use Visible Builder”. Then make a selection the choice “Select a Premade Structure”. Then make a selection the Inside Design Corporate Structure Pack from the Load From Library popup. After all, make a selection the Portfolio web page from the checklist of layouts and click on “Use this Structure”.

vertically align content

As soon as the format has loaded in your web page, you’re ready to move.

Way 1: Methods to Vertically Align Content material the use of Flex and Auto Margin

Open the row settings of the second one row at the web page (the only immediately underneath the row with the web page name). Below the design settings toggle open the Sizing possibility team and spot that “Equalize Column Heights” is already lively. Which means the row now has the flex assets (“show: flex;”) added to it.

vertically align content

Now pass to the Complicated tab settings for a similar row and upload the next css snippet underneath the Column 2 Major Component enter field.

margin: auto;

vertically align content

Now the second one column content material has shifted to transform vertically targeted.

Making the Content material Backside Aligned

If you wish to make your content material backside aligned so that each one modules will stack at the backside of your column, you’ll modify the margin price as follows:

margin: auto auto 0;

vertically align content

Aligning Content material Vertically for All Columns in Your Row

As a substitute of including “margin:auto” to each and every column in my view, You’ll be able to additionally vertically heart the content material of all columns on your row by way of including the next snippet to the principle component of your Row settings.

align-items: heart;

vertically align content

Or if you wish to have the entire content material of your columns to be backside aligned, you’ll upload this snippet:

align-items: flex-end;

And, don’t fail to remember that you might want to benefit from Divi’s Prolong Kinds function by way of proper clicking at the major component together with your css snippet and clicking “Prolong Major Component”.

vertically align content

Then prolong that major component css to all rows all over the web page (or phase) to vertically heart the entire content material of each and every column at the web page.

vertically align content

Now the whole thing is vertically targeted.

vertically align content

However, you could have spotted the white column background colour not spans the total peak of the row. It’s because we added “margin: auto” to the column. To mend this, you might want to alternate the row background colour to white and eliminate the row padding. However as an alternative, I’m going to turn you some way so that you can heart the content material of your column with out converting the margin.

Way 2: Vertically Aligning Content material the use of Column Flex Route

Within the first means, we took good thing about the flex assets being added to the row. This made each and every of our columns a “flex field” that may be vertically aligned just by adjusting the margin.

However there may be some way to be used to flex-direction to align the content material of our column with out dropping the “Equalize Column Top” impact that helps to keep our columns (and column backgrounds) the similar dimension. To do that we’re easy going so as to add a couple of traces of CSS to our column in order that the entire modules inside the column can be stacked vertically after which targeted.

Let’s return to our row within the earlier instance. Open up the Row Settings and take out any customized css you could have in there by way of proper clicking on Customized CSS and clicking “Reset Customized CSS Kinds”

Then upload the next CSS underneath Column 2 Major Component:

show: flex;
flex-direction: column;
justify-content: heart;

vertically align content

Or if I sought after to backside align the content material, merely alternate “justify-content: heart” to “justify-content: flex-end”.

vertically align content

What is excellent about this setup is if I’ve my content material vertically targeted and I make the row complete width, the content material remains targeted.

vertically align content

Making Blurbs with More than a few Quantities of Textual content Vertically Aligned

Making your column content material vertically targeted too can turn out to be useful for blurbs. As you realize, no longer each and every blurb could have the precise quantity of textual content used to explain the function or carrier. Making those blurbs vertically targeted can create a pleasing design on your format.

For this case, I’m going to vertically align the blurbs at the Virtual Bills House Web page Structure.

I’m going to first upload some differing quantities of frame textual content to the blurbs to offer a extra practical illustration of what a website online may seem like.

vertically align content

Now, I wish to pass to the row settings and “Equalize Column Heights”.

vertically align content

Now I will be able to upload my CSS snippets to align my content material and alter the design.

Below the Complicated tab of your Row Settings, we will be able to vertically heart the content material of our columns by way of including the next underneath Major Component:

align-items: heart;

vertically align content

Or alternate it to the next to lead them to backside aligned.

align-items: flex-end;

vertically align content

Or you’ll reset your customized css types and upload the next customized margins to make the primary column backside aligned and the 3rd column best aligned.

Column 1 Major Component CSS:

margin: auto auto 0;

Column 3 Major Component CSS:

margin: 0 auto auto;

vertically align content

What About One Column Layouts?

Technically, you don’t desire a css snippet or flex to get your one column content material vertically targeted. All you wish to have to do is be sure you have equivalent spacing above and underneath your content material (or modules). As a rule, folks want vertical targeted content material on layouts with more than one columns as a result of they would like the adjoining content material to line up completely.

A number of Packages

There are a large number of helpful packages vertically aligning your content material in Divi. This is able to turn out to be useful for headers with a two column format with the heading textual content in a single column and you wish to have to verify a CTA (button) within the different column is vertically targeted. It might even be useful for vertically centering trademarks in a six column format (particularly if the trademarks have quite other dimensions).

Ultimate Ideas

Even if this system does depend on a couple of small snippets of customized CSS, I imagine the appliance will also be extraordinarily helpful for the ones on the lookout for a handy guide a rough repair to a every so often bulky procedure. I would really like to listen to of alternative examples the place this may turn out to be useful.

Be happy to proportion your concepts and feedback underneath.


The publish How to Vertically Align Content in Divi gave the impression first on Elegant Themes Blog.

WordPress Web Design

[ continue ]