Jump to content

Help FIX mobile view with code block

Go to solution Solved by Ziggy,

Recommended Posts

Posted

Hello, I m workin to improve the look of my company website, and I created a footer with a code block using A.I.

It looks perfect on desktop view but in mobile view its veeeeery messed up and I cant seem to fix it, below is the code and the website is theinteriordoors.com

<!DOCTYPE html>
<html>
<head>
    <style>
        table {
            width: 75%;
            border-collapse: collapse;
            table-layout: fixed;
            margin-left: auto;
            margin-right: auto;
        }
        
        th, td {
            border: 0px solid black;
            padding: 20px;
            color: white;
            text-align: left;
        }
        
        th {
            background-color: ;
        }
        
        th {
            font-size: 28px;
            font-weight: normal;
        }
        
        .social-icon {
            display: inline-block;
            vertical-align: middle;
            margin-right: 20px;
        }
        
        .info-icon {
            display: inline-block;
            vertical-align: middle;
            margin-right: 10px;
            width: 25px; /* Adjust the width for information icons */
            height: 25px; /* Adjust the height for information icons */
        }
        
        .opening-hours {
            display: grid;
            grid-template-columns: 200px 1fr;
            grid-column-gap: 10px;
            align-items: center;
        }
        
        .day {
            font-weight: normal;
        }
        
        .footer-row {
            background-color: #332D2D;
            color: white;
            text-align: center;
        }
    </style>
</head>
<body>
    <table>
        <tr>
            <th>ABOUT OUR COMPANY</th>
            <th>CONTACT US</th>
            <th>OPENING HOURS</th>
        </tr>
        <tr>
            <td>We are a construction materials and services store that serves the entire Broward County region. With over 5 years of experience and family-run, we pride ourselves on providing the best customer service to our clients.</td>
            <td>
                <img src="/s/icon_location_footer.png" class="info-icon">
                1960 N Federal Hwy<br>
                Pompano Beach, 33062<br><br>
                <a href="tel:+19545976373">
    <img src="/s/icon_phone_footer.png" class="info-icon">
    (954) 597-6373
                </a><br><br>
                <a href="mailto:cs@axehomeanddesign.com">
    <img src="/s/icon_mail_footer.png" class="info-icon">
    cs@axehomeanddesign.com
                </a>
            </td>
            <td>
                <div class="opening-hours">
                    <div class="day">Monday to Friday:</div>
                    <div>9am - 5pm</div>
                    <div class="day">Saturday:</div>
                    <div>11am - 4pm</div>
                    <div class="day">Sunday:</div>
                    <div>Closed</div>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <a href="https://www.facebook.com/axehomedesign/" target="_blank">
                    <img src="/s/icon_fb_white.png" class="social-icon" style="width: 55px; height: 55px;">
                </a>
                <a href="https://www.instagram.com/axehomeanddesign/" target="_blank">
                    <img src="/s/icon_insta_white.png" class="social-icon" style="width: 58px; height: 58px;">
                </a>
                <a href="https://wa.me/19542805688" target="_blank">
                    <img src="/s/icon_whats_white.png" class="social-icon" style="width: 48px; height: 48px;">
                </a>
            </td>
            <td></td>
            <td></td>
        </tr>
        
    </table>
</body>
</html>

Capture.JPG

Posted

Can you share your website URL and this page?

It looks like you need some mobile-specific table styling. For a start setting the table width to 100% on mobile, the cell padding and heading font size all need changing for mobile.

You can do this by placing more styles within a media query like this:

@media only screen and (max-width:767px) {
   table {
      width: 100%;
   }
  th {
     font-size: 18px;
  }
}

(adding everything you need) and place it at the bottom of the styles.

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

📈 SEO Space (Referral link)
Ⓜ️ 
Will Myers' Plugins & Tutorials (Referral link)
 🔌 Ghost Squarespace Plugins (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲SQSP Themes (Referral link) 
Spark Plugin (Referral link) 
 🖼️Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) 

 Did I help? Buy me a coffee?

Posted
39 minutes ago, Ziggy said:

Can you share your website URL and this page?

It looks like you need some mobile-specific table styling. For a start setting the table width to 100% on mobile, the cell padding and heading font size all need changing for mobile.

You can do this by placing more styles within a media query like this:

@media only screen and (max-width:767px) {
   table {
      width: 100%;
   }
  th {
     font-size: 18px;
  }
}

(adding everything you need) and place it at the bottom of the styles.

Hey Ziggy! the website is https://www.theinteriordoors.com/

please take a look, on mobile the code I added in the footer looks like the image below. The table has 3 columns, and on mobile they are too narrow, would be better if it could be one cell below the other one.

 

Capture.JPG

  • Solution
Posted

You would have to change your table setup to be able to effectively stack these on mobile.

This CSS would stack them , but will leave all of the headings at the top, not aligned with the 

@media only screen and (max-width:767px) {
  td, the {
      display:block;
   }
}

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

📈 SEO Space (Referral link)
Ⓜ️ 
Will Myers' Plugins & Tutorials (Referral link)
 🔌 Ghost Squarespace Plugins (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲SQSP Themes (Referral link) 
Spark Plugin (Referral link) 
 🖼️Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) 

 Did I help? Buy me a coffee?

Posted
17 hours ago, Ziggy said:

You would have to change your table setup to be able to effectively stack these on mobile.

This CSS would stack them , but will leave all of the headings at the top, not aligned with the 

@media only screen and (max-width:767px) {
  td, the {
      display:block;
   }
}

Hey Ziggy! I ended up doing separated code blocks for each part... 🙂

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.