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. Background image adaptive row height

Background image adaptive row height

Scheduled Pinned Locked Moved General Discussion
2 Posts 2 Posters 41 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.
  • M Offline
    M Offline
    Mr_Tartiflette
    wrote on last edited by
    #1

    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! :)

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

      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

      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