make project thumbs have a fixed height / while filling it in with the correct aspect ratio
-
Hi all,
I will just rewrite my question cause my old post was not really clear:
is it possible to give the thumb container a specific height (px or %) and then let the project thumbnail be filled in with the object-fit: cover CSS command?So to say I would want to have the possibility in the thumbnail grid to change to height of the thumbnails, without interfering with the actual aspect ratio of the image. Also if that means cropping.
Im not sure if that is a feature request or something i could solve with adding CSS to the thumb class.
thanks a lot in advance
Leo
-
Dear @leooo
this is the only way I can think of:.ph { padding-bottom: 50% !important; } .ph img { object-fit: cover; }
Hope that helps!
Best!
Marius
-
@mariusjopen said in make project thumbs have a fixed height / while filling it in with the correct aspect ratio:
Dear @leooo
this is the only way I can think of:.ph { padding-bottom: 50% !important; } .ph img { object-fit: cover; }
Hope that helps!
Best!
Marius
@mariusjopen
Wow you saved my day! that is exactly the thing i was looking for! Now i dont need to make square thumbnails for everything and I like that I can play around with the % for the height!
Seriously I would have never gotten to that solution with my basic css skills. I didnt even find the .ph class in the inspector ^^
So useful especially for mobile! Thanks a lot!
http://editedit.dreamhosters.com/category/test/ -
Dear @leooo
the padding is used to set the height of the images.
This is kind of a trick and is not very commonly used. But in the Gridder it is very useful.You can change the padding to change the height of the images.
Hope that helps :-)
Best!
Marius
-
@mariusjopen yes very much. i was playin around with that already very useful. But I realized its better to disable this in the specific project view, cause it messes around with cover feature and generally images in the first row of the gridder. but still so very useful! thanks a lot!
-
Dear @leooo
you could make it only for for a specific Thumbnail Grid when you give it an idea.Best!
Marius
-
@mariusjopen is it possible to use this method with an element grid in stead of a thumbnail grid?
In the element-grid, the ph container seems to be empty.
-
Dear @fr
With Project Thumbnails within the Element Grid this is possible - With standard images not.
The image dimensions are set normally and not with this 'PH' padding.So Image <img> being 100% width and its parent container controlling its dimensions:
E.g
.parent-container{ width:48%; } img{ width:100%; height:auto; }
Hope this answers your question :)
Best wishes
Richard
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