Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Square "containers" for gridder

Square "containers" for gridder

Scheduled Pinned Locked Moved General Discussion
9 Posts 2 Posters 94 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    yelmarb
    wrote on last edited by
    #1

    Hey @arminunruh , my love for laytheme runs deep as you know but I've been frustrated with the gridder because of the way it snaps to the taller thumbnail of whatever image is in the column. This makes a big portrait thumbanil and a small landscape thumbnail. See here:
    Image

    If you try to make both portrait and landscape thumbnails roughly the same size, the landscape images will span 2 columns and the page loses its uniformity:
    alt text

    What I would like for the thumbnail grid, is for both landscape and portrait images to stay within the same column as well as be the same approximate same size, just like this:
    alt text

    The only way to do this is buy having a square "container" within a column and for the image to be centered both vertical and horizontal within the square.

    Is this something I could do with CSS? Or could it be something that you could implement for Laytheme users?

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      yelmarb
      wrote on last edited by
      #2

      Hey @arminunruh , would be amazing to make this happen as the gridder doesn’t play nicely with combined horizontal and vertical images. Could you please look into this?

      1 Reply Last reply
      0
      • arminunruhA Offline
        arminunruhA Offline
        arminunruh
        Global Moderator
        wrote on last edited by arminunruh
        #3

        sure no problem!

        Screenshot 2025-03-21 at 17.41.16.png

        this is what i came up with for elementgrid:

        .type-elementgrid .ph{
            padding-bottom: 100%!important;
            background-color: transparent!important;
        }
        .type-elementgrid img, .type-elementgrid video{
            object-fit: contain;
            height: 100%!important;
            width: 100%!important;
        }
        

        if you want to use this css for thumbnailgrid, you can use:

        .type-thumbnailgrid .ph{
            padding-bottom: 100%!important;
            background-color: transparent!important;
        }
        .type-thumbnailgrid img, .type-thumbnailgrid video{
            object-fit: contain;
            height: 100%!important;
            width: 100%!important;
        }
        

        for thumbnailgrid and elementgrid use layout type "middle aligned". i think "top aligned" may also work

        1 Reply Last reply
        0
        • Y Offline
          Y Offline
          yelmarb
          wrote on last edited by yelmarb
          #4

          That's amazing! Thank you so much Armin!! Just one thing, is there a way to use this code in the regular gridder (instead of using it with elementgrid or thumbnailgrid)?

          BTW, you should have a tip jar, buy me a coffee or a Patreon option link. This stuff is gold!

          1 Reply Last reply
          0
          • arminunruhA Offline
            arminunruhA Offline
            arminunruh
            Global Moderator
            wrote on last edited by
            #5

            thx!!

            if you wanted to do that in the gridder, you could probably set your column count really high and then have more fine grained control over the widths of your elements and the spaces between them

            for just regular image elements use:

            .col.type-img .ph{
                padding-bottom: 100%!important;
                background-color: transparent!important;
            }
            .type-img img{
                object-fit: contain;
                height: 100%!important;
                width: 100%!important;
            }
            

            before:

            Screenshot 2025-03-23 at 09.12.10.png

            Screenshot 2025-03-23 at 09.12.22.png

            after:
            Screenshot 2025-03-23 at 09.16.06.png

            1 Reply Last reply
            0
            • Y Offline
              Y Offline
              yelmarb
              wrote on last edited by
              #6

              Thank you so much Armin! That works perfectly!!!

              1 Reply Last reply
              1
              • arminunruhA arminunruh referenced this topic on
              • Y Offline
                Y Offline
                yelmarb
                wrote on last edited by yelmarb
                #7

                Hey Armin, the code obviously changes every single category and project gallery, which is not ideal.

                Is there a way to add an HTML class and ID to categories so I can isolate where the "object-fit" code targets?

                1 Reply Last reply
                0
                • arminunruhA Offline
                  arminunruhA Offline
                  arminunruh
                  Global Moderator
                  wrote on last edited by arminunruh
                  #8

                  sure.

                  just write

                  .slug-hello

                  before every css statement.

                  where the slug "hello" is the slug of the page/catregory/project you want to apply this to.
                  please read this:
                  https://laytheme.com/documentation/custom-css-styling.html#css-based-on-current-page

                  above link also shows you can target pages by their id too

                  so:

                  .slug-hello .col.type-img .ph{
                      padding-bottom: 100%!important;
                      background-color: transparent!important;
                  }
                  .slug-hello .type-img img{
                      object-fit: contain;
                      height: 100%!important;
                      width: 100%!important;
                  }
                  

                  and

                  .slug-hello .type-elementgrid .ph{
                      padding-bottom: 100%!important;
                      background-color: transparent!important;
                  }
                  .slug-hello .type-elementgrid img,
                  .slug-hello .type-elementgrid video{
                      object-fit: contain;
                      height: 100%!important;
                      width: 100%!important;
                  }
                  

                  and

                  .slug-hello .type-thumbnailgrid .ph{
                      padding-bottom: 100%!important;
                      background-color: transparent!important;
                  }
                  .slug-hello .type-thumbnailgrid img,
                  .slug-hello .type-thumbnailgrid video{
                      object-fit: contain;
                      height: 100%!important;
                      width: 100%!important;
                  }
                  
                  
                  1 Reply Last reply
                  0
                  • Y Offline
                    Y Offline
                    yelmarb
                    wrote on last edited by
                    #9

                    Thank you again Armin, that works perfectly and is just what I was after.

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    I also code custom websites or custom Lay features.
                    💿 Email me here: 💿
                    info@laytheme.com

                    Before you post:
                    1. When using a WordPress Cache plugin, disable it or clear your cache.
                    2. Update Lay Theme and all Lay Theme Addons
                    3. Disable all Plugins
                    4. 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:
                    1. Post a link to where the problem is
                    2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                    3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                    Online Users
                    Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                    laytheme.com
                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Search