Some help with vertical alignment!

Hi guys! I’d like to point out that it is not necessary to add an additional jQuery library to your page. Adding a second jQuery script would add an unnecessary 100k to your page. You can access Webflow’s version of jQuery in any custom embed or <head> script.

Here’s an updated snippet of code, which uses Webflow’s version of jQuery:

<script>
var Webflow = Webflow || [];  
Webflow.push(function () {  
  var inner = $('.title-inner');
  var offset = ($('.title-parent').height() - inner.height()) / 2;
  inner.css({ 'margin-top': offset, 'margin-bottom': offset });
});
</script>

Simply replace ‘title-inner’ and ‘title-parent’ with your class names.

More tips on Webflow.js can be found here:

3 Likes