Last active
June 5, 2021 16:42
-
-
Save cesgarma/30a4b022b7e1522d4c572a1e39bcce61 to your computer and use it in GitHub Desktop.
Explanation & Calculations
How To Force Change Divi Image Aspect Ratios
Most of us are familiar with image or video aspect ratios. Lots of times our devices are made to these proportions as well. The first number in the ratio is the width, and the se
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*image aspect ratio landscape 16:9*/ | |
.pa-image-16-9 .et_pb_image_wrap { | |
padding-top: 56.25%; | |
display: block; | |
} | |
.pa-image-16-9 .et_pb_image_wrap img { | |
position: absolute; | |
height: 100%; | |
width: 100%; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
object-fit: cover; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*image aspect ratio landscape 3:2*/ | |
.pa-image-3-2 .et_pb_image_wrap { | |
padding-top: 66.66%; | |
display: block; | |
} | |
.pa-image-3-2 .et_pb_image_wrap img { | |
position: absolute; | |
height: 100%; | |
width: 100%; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
object-fit: cover; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*image aspect ratio landscape 4:3*/ | |
.pa-image-4-3 .et_pb_image_wrap { | |
padding-top: 75%; | |
display: block; | |
} | |
.pa-image-4-3 .et_pb_image_wrap img { | |
position: absolute; | |
height: 100%; | |
width: 100%; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
object-fit: cover; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*image aspect ratio landscape 3:4*/ | |
.pa-image-3-4 .et_pb_image_wrap { | |
padding-top: 133.33%; | |
display: block; | |
} | |
.pa-image-3-4 .et_pb_image_wrap img { | |
position: absolute; | |
height: 100%; | |
width: 100%; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
object-fit: cover; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*image aspect ratio landscape 9:16*/ | |
.pa-image-9-16 .et_pb_image_wrap { | |
padding-top: 177.77%; | |
display: block; | |
} | |
.pa-image-9-16 .et_pb_image_wrap img { | |
position: absolute; | |
height: 100%; | |
width: 100%; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
object-fit: cover; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*image aspect ratio landscape 2:3*/ | |
.pa-image-2-3 .et_pb_image_wrap { | |
padding-top: 150%; | |
display: block; | |
} | |
.pa-image-2-3 .et_pb_image_wrap img { | |
position: absolute; | |
height: 100%; | |
width: 100%; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
object-fit: cover; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*image aspect ratio square 1:1*/ | |
.pa-image-1-1 .et_pb_image_wrap { | |
padding-top: 100%; | |
display: block; | |
} | |
.pa-image-1-1 .et_pb_image_wrap img { | |
position: absolute; | |
height: 100%; | |
width: 100%; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
object-fit: cover; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment