Front-end webpage presenting coding malfunction - Written in HTML/CSS

After completing the development of a website at , I tested it on my PC and everything looked good. However, when I asked a friend to review the site, she pointed out that on mobile devices, the section with 4 boxes was appearing squeezed together despite looking fine on a PC.

Upon checking the issue on my own phone, I noticed the same problem but couldn't figure out the reason behind it. Below is the code structure that I used for this specific section - just for reference, the site is based on Wordpress and I had to customize this area due to difficulties with the built-in column feature.

I would greatly appreciate any feedback or suggestions regarding this matter.

<style>

    .gallery_container{
        max-width: 1200px;
        padding: 30px;
        margin: 20px auto;
    }

    #shop_column{
        column-count: 2;
        column-gap: 15px;
    }

    #shop_page{
        text-align: center;
        font-family: 'Tangerine', cursive;
        font-size: 36px;
        padding: 0px;
        margin: 0px auto;
    }

    #shop_image{
        cursor: pointer;
        width: 750px;
        height: 345px;
        padding: 10px;
        margin: 10px auto;
    }


</style>



<div class="gallery_container">
    <div id="shop_column">
        <a href="http://services.codexcentre.com/new-build/">
            <img id="shop_image" src="imgs/home01.jpg">
        </a>
        <p id="shop_page">New Build</p>
        <a href="http://services.codexcentre.com/dining-remodel/">
            <img id="shop_image" src="imgs/dining01.jpeg">
        </a>
        <p id="shop_page">Living Room Remodel</p>
    </div>
    <div id="shop_column">
        <a href="http://services.codexcentre.com/kitchen-remodel/">
            <img id="shop_image" src="imgs/kitchen01.jpg">
        </a>
        <p id="shop_page">Kitchen Remodel</p>
        <a href="http://services.codexcentre.com/bathroom-remodel/">
            <img id="shop_image" src="imgs/bathroom01.jpg"> 
        </a>
        <p id="shop_page">Bathroom Remodel</p>
    </div>      
</div>

Answer №1

What outcomes are you anticipating?

Upon closer examination, it appears that there are two issues depending on your desired outcome.

  1. You currently have two columns appearing on mobile, but if you only want one column, you can rectify this by implementing a media query to adjust the layout for mobile devices.
  2. The images may be stretching due to fixed values being set.

Answer №2

It is essential to ensure that your website is responsive and visually appealing across all devices.

@media(Max-width:345px){#shop_image{width:250px}}

Additionally, adjust other elements based on the device's width for a seamless user experience.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Update the CSS of a different element when hovering

Hello to all the jQuery developers out there! I have a question that's fairly simple. I'm trying to change a CSS attribute for an element when I hover over a different element on the page. I've created a fiddle for you to review, and I&apos ...

Tips for transforming a hover menu into a clickable menu

The scenario above demonstrates that when hovering over the dropdown menu, it displays a submenu. However, I want the submenu to be displayed after clicking on the dropdown text. Could anyone provide assistance on how to change the hovermenu to a clickabl ...

JavaScript: Understanding the concept of closure variables

I am currently working on an HTML/JavaScript program that involves running two counters. The issue I am facing is with the reset counter functionality. The 'initCounter' method initializes two counters with a given initial value. Pressing the &a ...

SSI stands for Server Side Includes, a feature that allows

I have multiple versions of the same HTML page, each with only one hidden variable that is different. This variable is crucial for tracking purposes. Now, I am exploring options to rewrite this by incorporating a HTML file with a hidden variable. Here is ...

Pressing the reset button will restore the table to its original

As a new React developer with experience mainly in hooks, I have been struggling to find a good example involving hooks. Currently, I am working on implementing an antd table with search functionality. My question is, when a user types something into the ...

How to align several lines of text in a table cell

I've been trying to center multiple lines of text in a table cell using the table method, but no matter how many online guides and SO posts I follow, I just can't seem to get it right. What I'm aiming for is to have the text perfectly cente ...

Retrieve the class that corresponds to the element in the given list

In my JavaScript code, I have a NodeList of elements that were selected by querying multiple classes. I am using a "for" loop to iterate through the list. What I need is a concise one-liner to quickly determine which class each element was selected by so I ...

Resetting the quiz by utilizing the reset button

Hello everyone, I'm new to this platform called Stack Overflow. I need some help with my quiz reset button. It doesn't seem to be working as intended. According to my code, when the reset button is clicked at the end of the quiz, it should bring ...

Enhance your website with a unique hover and left-click style inspired by the functionality of file explorer

I have a set of items like this: I am trying to replicate the functionality of a file explorer in terms of item selection. To clarify, I aim to create a feature where hovering over an item and left-clicking it would generate a virtual rectangle to select ...

Utilizing Ruby interpolation to dynamically select elements in Capybara's CSS selectors

Having trouble with invalid selector errors when attempting to locate an element using capybara This method is successful: page.find("#widget_amount_Standard") But I encounter issues when trying any of the following: credit_type = "Standard" page.find( ...

An issue has been detected where the bullet list is uneven due to the CSS property/value columns being set

Is there a more effective way to split a bulleted list into two columns than the method I am currently using and ensure that the columns are aligned at the top? .hand-bullet-list ul{ list-style-type: none; margin-left: 0px; } .hand-bullet-list ...

Efficient Techniques for Concealing and Revealing Navigation Menus using HTML, CSS, and JavaScript

I need help making the menu icon toggle the navigate menu between showing and hiding when clicked on the top right corner of the screen. For better understanding, here is an accompanying image: https://i.stack.imgur.com/oy6d9.png However, the current co ...

The custom HTML menu implementation is causing the jQuery autocomplete to lose its "Select" functionality

Seeking assistance in implementing jQuery autocomplete with a custom drop down menu. I have managed to customize menu items using the data()._renderItem method (which is currently commented out), however, this approach disables the menu "Select" function ...

I would like the background image to perfectly fit the dimensions of the parent container

https://i.sstatic.net/PlCYU.png Is there a way to prevent the background image from overflowing and causing a horizontal scroll bar to appear? The layout of the page consists of two columns, with each column taking up 50% of the width. The left column con ...

What is the best method for retrieving data using Selenium when the class name may vary slightly?

Hypothetically, let's consider the following HTML code snippet displayed on a website: <div class="box"> <div class="a1"></div> <div class="a2"></div> <div class="a3" ...

What is the best way to position the underline to appear beneath the second line in mobile view?

I have successfully incorporated a code to add a blue underline to the company name. However, in mobile view, the blue line appears on the first line. How can I adjust it so that it starts from the second line? Below is my CSS code: label { margin: 0; ...

Tips for aligning two divs of varying sizes side by side

Imagine having two div elements: <div id="container"> <div id="left">line one</div> <div id="right">line one<br/>line two</div> </div> Is there a way to have the left and right divs align at the bottom li ...

Trouble arises with jQuery when utilizing wp_editor() on the front end

Attempting to utilize the tinyMCE editor on the front end using the wp_editor() function (introduced in WP 3.3) is causing jQuery to malfunction when included in a post via a shortcode. According to the WordPress codex: "Once initialized, the WYSIWYG edit ...

How can I show HTML content in a ListView on an Android device?

One way I am populating a ListView from a database is by using the following code. The only difference is that the COL_TXT_TRANSL2 field contains HTML formatting: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ...

Switch back to the previous page by clicking on 'Go back to the shop'

I came across the following code snippet that adds a 'Return to Shop' button, and it functions perfectly. add_action('woocommerce_cart_actions', function() { ?> <a class="button wc-backward" href="<?php echo esc_url( apply ...