Skip to main content
All CollectionsTroubleshooting and FAQsFrequently Asked QuestionsPortfolio Module
How to Change the Image's Aspect Ratio Displays on the Portfolio Module
How to Change the Image's Aspect Ratio Displays on the Portfolio Module

Learn how to change the featured image's aspect ratio in the Portfolio Module to enhance your site's visual appeal and project presentation.

Updated over 3 months ago

The visual presentation of your portfolio can significantly impact how visitors perceive your work. In Divi, the Portfolio Module uses the Grid Layout to display the images at a default aspect ratio of 400/250.

Adjusting the aspect ratio of the featured images can enhance the overall aesthetic and ensure that your projects are presented in the best possible light.

This article will guide you through the steps to change the aspect ratio of the featured images displayed by the Portfolio Module.

  1. Open the Portfolio module's setting by clicking on the Gear icon

  2. Go to the Design tab β†’ Layout and choose the Grid option

  3. Go to Advanced Tab β†’ Custom CSS β†’ Free Form CSS and add this CSS code

    selector {
    --aspect-ratio-width: 16;
    --aspect-ratio-height: 9;
    --aspect-ratio: calc(var(--aspect-ratio-height) / var(--aspect-ratio-width));
    --padding-top: calc(var(--aspect-ratio) * 100%);
    }

    selector .et_portfolio_image {
    padding-top: var(--padding-top);
    display: block;
    position: relative;
    }

    selector .et_portfolio_image img {
    position: absolute;
    aspect-ratio: var(--aspect-ratio-width) / var(--aspect-ratio-height);
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    object-fit: cover;
    width: 100%;
    height: 100%;
    }

Pro Tip: In the above CSS code, all you need to change is the value of the CSS variables called --aspect-ratio-width and --aspect-ratio-height.

Note: Because the above CSS code uses CSS variables and the calc() function, the syntax checker will flag those as invalid CSS rules. You can safely ignore those.

Portfolio Module - Change Image Aspect ratio

The result can be seen in the screenshot below:

  • Aspect Ratio of 1/1 (square)

    Portfolio Module - Images with 1/1 aspect ratio

  • Aspect Ratio of 16/9

    Portfolio Module - Images with 1/1 aspect ratio

  • Aspect Ratio of 4/3

    Portfolio Module - Images with 4/3 aspect ratio

  • Aspect Ratio of 3/2

    Portfolio Module - Images with 3/2 aspect ratio

  • Aspect Ratio of 9/16

    Portfolio Module - Images with 9/16 aspect ratio

  • Aspect Ratio of 3/4

    Portfolio Module - Images with 3/4 aspect ratio

  • Aspect Ratio of 2/3

    Portfolio Module - Images with 2/3 aspect ratio
Did this answer your question?