Background image adaptive row height
-
Hello,
First of all, thank you for this wonderful theme!
I'm struggling to adapt the row height according to the height of content images. There are several goals I want to achieve, and after a few tests and research, I’m still struggling:
Project page test: https://www.studiojanvermeulen.eu/soho/
01. First image when arriving on page
OK: Row height 100vh - 100px, adaptive background image to follow this height and conserve its proportion.
NOT OK 1: When the width of the window is too large, I would like the image to stick to the left and not be centered.
NOT OK 2: When the width of the window is too small, I would like the row to have the height of the image instead of 100vh - 100px, so that the following content appears just after it..full-height { display: flex; justify-content: flex-start; align-items: center; padding: 0 50px; height: calc(100vh - 100px); box-sizing: border-box; } .full-height img { max-height: 100%; width: calc(100% - 100px); object-fit: contain !important; } .full-height .background-image{ left: 50px; right: 50px; width: auto; justify-content: flex-start; }
02. Other rows
I would like the rows to have a maximum height of 100vh - 100px so that visitors always see the picture entirely according to their screen size, while keeping the image proportionate. If the window is too large, the image should stick to its position in the grid (either left or right). The CSS provided does not work as expected:
.row-height { max-height: calc(100vh - 100px) !important; width: auto; object-fit: contain !important; } .row-height img { max-height: 100% !important; width: auto; object-fit: contain !important; }
Does anyone have any ideas to help me?
For Case 01, the image is set as a background, but it can be set as an image if that’s easier. For Case 02, images are used due to the possible presence of other images or text in the same row.
Thank you! :)
-
sure!!
you explained it very well!
how about i just create this CSS for you and put it in your custom css field?
then i will post the CSS here too so others can see how to do it.can you please:
can you send your website address, /wp-admin/ username and password and a link to this topic to info@laytheme.com?
and sorry for the late reply
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it