Change the height of a Divi Button module

|

Divi buttons are a popular module used in Divi websites to create attractive calls to action. In some cases, you may want to adjust the height of the Divi button module to make it stand out more on your page. In this post, I will explain how to adjust the height of a Divi button.

Setting the Button Module (Minimum) Height

The Divi button module doesn't include an option to set its height, but you can do so by adding the following CSS code:

min-height: 100px;

Into the module's custom CSS option at:

Button Settings > Advanced > Custom CSS > Main Element

If you need to be able to apply the same height to multiple buttons, you can instead add the following CSS to your site:

.custom-height-buttons.et_pb_button {
	min-height: 100px;
}

And then add the following class:

custom-height-buttons

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Vertically Aligning the Button Module Text

If you've increased the min-height of your buttons, as above, then you'll find that the button text sits towards the top of the button area. If you'd like, instead, to vertically align this text in the center of the button, you can do so by adding the following CSS to your site: 

.vertically-aligned-button {
	display: inline-flex !important;
	align-items: center;
}
.vertically-aligned-button:after {
	right: 8px;
}

And then adding this class:

vertically-aligned-button

to any buttons you wish to vertically-align the text on. You can add the class at:

Button Settings > Advanced > CSS ID & Classes > CSS Class

And here's an example of the result:

Making the Button Wider / Centering the Text

If you use the above technique, then since we're converting the button into a "flex" element, the method of centering the button text horizontally changes. We can still use the "width" property to set the width of the button, but then need to use the "justify-content" property to center align the text. To so we can, for example, add the following CSS rules alongside the earlier ones:

width: 100%;
justify-content: center;

This post may contain referral links which may earn a commission for this site

Divi Booster

Hundreds of new features for Divi
in one easy-to-use plugin

0 Comments

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.