Jump to content

Make table responsive on mobile

Recommended Posts

21 hours ago, merakiconceptstudio said:

Site URL: https://pend.squarespace.com/services

Password: test

I'd like to keep four columns on mobile, if possible! Happy to make the text very small to facilitate this. All I can find online is CSS for stacking... Any pointers will be much appreciated. 🙂

This simple approach may helps, though if you want it to be more dynamic then javascript is a proper choice

@media only screen and (max-width: 640px) {
      .mytable {
          table-layout: fixed;
          width: 100%;
      }
      .mytable td {
        padding: 2px;
      }
      .mytable tr h4 {
        cursor: pointer;
      }
      .mytable tr h4 + p {
          position: absolute;
          z-index: 9999;
          background: #fff;
          padding: 10px;
          opacity: 0 !important;
          margin-top: -20px;
          transition-delay: 0s !important;
          transition-duration: 0.5s !important;
      }
      .mytable tr h4 {
        position: relative;
        display: inline-block;
        border-bottom: 1px dotted black; 
      }
      .mytable tr h4:hover + p {
          opacity: 1 !important;
      }
}

image.thumb.png.0b1d266822f0634abb3d09bd5fd5cb1b.png

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

 

Link to comment
On 5/12/2021 at 2:52 PM, merakiconceptstudio said:

Thank you so much! This is a fantastic solution. Struggling to click the hyperlinks on mobile though—it only works after a few attempts. Any ideas? Could we maybe turn it into a text that says "Tell me more"?

Do you still need help?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.