Is there a method to ensure that Text First and Image First layouts are consistently displayed in a uniform manner?

When creating a Shopify theme for a client, I encountered an issue with the layout of my liquid file. Specifically, when using the text-first layout, the image in the image-with-text div is partially hidden due to the content that follows it causing the height to collapse.

{% assign selectedImage = section.settings.image %}
{% assign layout = section.settings.layout %}

<div class='image-with-text'>
  <div class='container'>
    <div class='wrapper {% if layout == "image-first" %} image-first {% endif %}'>
      <div class='content-container'>
        <div class='content-inner'>
          <h3 class='title'>
            {{ section.settings.title }}
          </h3>
          <div class='text-container'>
            {{ section.settings.content }}
          </div>
          <div class='button-container'>
            <a href='{{ section.settings.button-link }}' class='button'>{{ section.settings.button-text }}</a>
          </div>
        </div>
      </div>
      <div class="image-container">
        {% if selectedImage %}
          <img
              src="{{ selectedImage.src | img_url: '600x600' }}"
              srcset="{{ selectedImage.src | img_url: '400x400' }} 400w,
              {{ selectedImage.src | img_url: '800x800' }} 800w,
              {{ selectedImage.src | img_url: '1200x1200' }} 1200w"
              sizes="(max-width: 400px) 100vw,
             (max-width: 800px) 50vw,
             33.3vw"
              alt="{{ selectedImage.alt | escape }}"
          />
        {% endif %}
      </div>
    </div>
  </div>
</div>;

{% style %}
  /**
  text with image and accent dots
  */
  .image-with-text {
    position: relative;
    display: block;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
  }

  .image-with-text .wrapper {
    display: inline-flex;
    align-items: stretch;
    justify-content: space-between;
    width: 100%;
    position: relative;
  }

  .image-with-text .image-container,
  .image-with-text .content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
  }

  .image-with-text .content-container {
    display: flex;
    flex-direction: column;
  }


  .wrapper.image-first {
    flex-direction: row-reverse;
  }


  .image-with-text .image-container img {
    width: 100%;
    min-height: calc(100% + (160px * 3));
    object-fit: cover;
  }

  .image-with-text .content-container .content-inner {
    z-index: 2;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 40px;
    transform: translate(120px, 160px);
    background-color: white;
  }

  .image-with-text .image-first .content-container .content-inner {
    transform: translate(-120px, 160px);
  }

  .image-with-text .content-inner {
    align-self: stretch;
    height: auto;
  }

  .image-with-text .content-inner h3{
    margin-top: 0;
    font-size: 64px;
    margin-bottom: 0;
  }
{% endstyle %}

{% schema %}
{
  "name": "Accented Text with Image",
  "class": "section",
  "disabled_on": {
    "groups": ["header", "footer"]
  },
  "settings": [
    {
      "type": "image_picker",
      "id": "image",
      "label": "t:sections.image-with-text.settings.image.label"
    },

    {
      "type": "text",
      "id": "title",
      "label": "Title",
      "default": "Image with text"
    },

    {
      "type": "richtext",
      "id": "content",
      "label": "Content",
      "default": "<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus condimentum vestibulum ante, vel ultrices ante cursus eget. Vivamus finibus turpis eu quam feugiat, at convallis sapien finibus. Suspendisse potenti. Mauris nisl diam, accumsan fringilla nisi vitae, pharetra blandit erat. Nam purus leo, posuere sed viverra ut, rutrum sit amet justo.</p>"
    },

    {
      "type": "url",
      "id": "button-link",
      "label": "Button Link"
    },

    {
      "type": "text",
      "id": "button-text",
      "label": "Button Text",
      "default": "Read More"
    },


    {
      "type": "select",
      "id": "layout",
      "options": [
        {
          "value": "image-first",
          "label": "Image first"
        },
        {
          "value": "text-first",
          "label": "Text first"
        }
      ],
      "default": "image-first",
      "label": "Layout",
      "info": "Place image first or second"
    },
    {
      "type": "select",
      "id": "content_layout",
      "options": [
        {
          "value": "no-overlap",
          "label": "t:sections.image-with-text.settings.content_layout.options__1.label"
        },
        {
          "value": "overlap",
          "label": "t:sections.image-with-text.settings.content_layout.options__2.label"
        }
      ],
      "default": "no-overlap",
      "label": "t:sections.image-with-text.settings.content_layout.label"
    }
  ],
  "blocks": [
    {
      "type": "heading",
      "name": "t:sections.image-with-text.blocks.heading.name",
      "limit": 1,
      "settings": [
        {
          "type": "inline_richtext",
          "id": "heading",
          "default": "Image with text",
          "label": "t:sections.image-with-text.blocks.heading.settings.heading.label"
        }
      ]
    },
    {
      "type": "text",
      "name": "t:sections.image-with-text.blocks.text.name",
      "limit": 1,
      "settings": [
        {
          "type": "richtext",
          "id": "text",
          "default": "<p>Pair text with an image to focus on your chosen product, collection, or blog post. Add details on availability, style, or even provide a review.</p>",
          "label": "t:sections.image-with-text.blocks.text.settings.text.label"
        },
        {
          "type": "select",
          "id": "text_style",
          "options": [
            {
              "value": "body",
              "label": "t:sections.image-with-text.blocks.text.settings.text_style.options__1.label"
            },
            {
              "value": "subtitle",
              "label": "t:sections.image-with-text.blocks.text.settings.text_style.options__2.label"
            }
          ],
          "default": "body",
          "label": "t:sections.image-with-text.blocks.text.settings.text_style.label"
        }
      ]
    },
    {
      "type": "button",
      "name": "t:sections.image-with-text.blocks.button.name",
      "limit": 1,
      "settings": [
        {
          "type": "text",
          "id": "button_label",
          "default": "Button label",
          "label": "t:sections.image-with-text.blocks.button.settings.button_label.label",
          "info": "t:sections.image-with-text.blocks.button.settings.button_label.info"
        },
        {
          "type": "url",
          "id": "button_link",
          "label": "t:sections.image-with-text.blocks.button.settings.button_link.label"
        },
        {
          "type": "checkbox",
          "id": "button_style_secondary",
          "default": false,
          "label": "t:sections.image-with-text.blocks.button.settings.outline_button.label"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "Accented Text With Image",
      "blocks": [
        {
          "type": "heading"
        },
        {
          "type": "text"
        },
        {
          "type": "button"
        }
      ]
    }
  ]
}
{% endschema %}

The expected variants should resemble this, but unfortunately, this desired outcome is not achieved.

While placing the image works correctly, setting it to be the second element causes it to collapse as previously described.

Despite trying various CSS solutions, the issue seems to be order-dependent where only the image can determine the height properly.

I prefer to avoid using any makeshift methods to resolve this problem.

Answer №1

If you're experiencing issues with the image height collapsing in the "text-first" layout, it may be due to how you are utilizing Flexbox and the order of elements. To achieve the desired layout without resorting to unconventional methods, consider making adjustments to your Liquid and CSS code by following these steps:

  • Ensure that the image and content are wrapped in separate containers.
  • Utilize Flexbox for both containers to maintain consistent heights.
  • Reorganize the elements within the "text-first" layout using Flexbox's order property.

See below for the modified Liquid and CSS code suggestions:

{% assign selectedImage = section.settings.image %}
{% assign layout = section.settings.layout %}

<div class='image-with-text'>
  <div class='container'>
    <div class='wrapper {% if layout == "image-first" %} image-first {% endif %}'>
      <div class="content-container">
        <div class='content-inner'>
          <h3 class='title'>
            {{ section.settings.title }}
          </h3>
          <div class='text-container'>
            {{ section.settings.content }}
          </div>
          <div class='button-container'>
            <a href='{{ section.settings.button-link }}' class='button'>{{ section.settings.button-text }}</a>
          </div>
        </div>
      </div>
      <div class="image-container">
        {% if selectedImage %}
          <img
            src="{{ selectedImage.src | img_url: '600x600' }}"
            srcset="{{ selectedImage.src | img_url: '400x400' }} 400w,
                    {{ selectedImage.src | img_url: '800x800' }} 800w,
                    {{ selectedImage.src | img_url: '1200x1200' }} 1200w"
            sizes="(max-width: 400px) 100vw,
                   (max-width: 800px) 50vw,
                   33.3vw"
            alt="{{ selectedImage.alt | escape }}"
          />
        {% endif %}
      </div>
    </div>
  </div>
</div>

{% style %}
  /**
  text with image and accent dots
  */
  .image-with-text {
    position: relative;
    display: block;
    justify-content: center;
    align-items: center;
    padding: 20px;
    width: 100%;
  }

  .image-with-text .wrapper {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    width: 100%;
    position: relative;
  }

  .image-with-text .image-container,
  .image-with-text .content-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
  }

  .image-with-text .content-container {
    display: flex;
    flex-direction: column;
  }

  .wrapper.image-first {
    flex-direction: row-reverse;
  }

  .image-with-text .image-container img {
    width: 100%;
    min-height: calc(100% + (160px * 3));
    object-fit: cover;
  }

  .image-with-text .content-container .content-inner {
    z-index: 2;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 40px;
    background-color: white;
  }

  .image-with-text .image-first .content-container .content-inner {
    transform: translate(120px, 160px);
  }

  .image-with-text .content-inner {
    align-self: stretch;
    height: auto;
  }

  .image-with-text .content-inner h3{
    margin-top: 0;
    font-size: 64px;
    margin-bottom: 0;
  }
{% endstyle %}

Answer №2

Upon closer inspection, I discovered that my initial problem-solving approach was flawed. By simply adding margin to the .content-inner element, I successfully resolved the issue.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
... (omitting rest of HTML structure for brevity)
<p>While the code may appear different now, it effectively tackled the underlying issue at hand. Before deploying it in a live environment or theme, I intend to reformat it.</p>
</div></answer2>
<exanswer2><div class="answer accepted" i="77229217" l="4.0" c="1696408431" a="SGFybGV5IFVycXVoYXJ0" ai="13315244">
<p>After conducting some investigation, I realized that my previous approach to the problem was incorrect. The simple addition of margin to the .content-inner element solved the problem.</p>
<pre><code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image with Text</title>
<style>
    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

body {
    font-family: Arial, sans-serif;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 40px; /* 40px padding on both sides */
}

.image-text-section {
    display: flex;
    margin: 80px 0;
}

.left-content, .right-content {
  flex: 1;
    position: relative;
}

.content-inner{
    position: relative;
    z-index: 2;
    margin-top: 160px;
    margin-bottom: 320px;
    padding: 40px;
    background-color: #fff;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);
}

.left-content,
.left-image { order: 1; }

.right-content,
.right-image { order: 2; }

.left-content .content-inner{ 
    transform: translateX(120px);
}

.right-content .content-inner{ 
    transform: translateX(-120px);
}

.right-image, .left-image {
    flex: 1;
    overflow: hidden;
    position: relative;
    width: 100%;
    object-fit: cover;
}

.image {
    width: 100%;
    height: auto;
    min-height: calc(100% + (3 * 160px)); /* Set min-height based on content height + 3 times 160px */
    object-fit: cover;
}

.title {
    font-size: 64px;
    margin-bottom: 10px;
}

.text {
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.button {
    display: inline-block;
    background-color: #007BFF;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
}

    </style>
</head>
<body>
    <div class="container">
        <section class="image-text-section">
                <div class="left-content">
                    <div class="content-inner">
                        <h3 class="title">Our Process</h3>
                        <p class="text">
Nunc ultrices nisi vel ultricies aliquam. Nulla arcu dui, posuere quis eros eget, convallis maximus purus. Nulla sed urna et orci ultrices bibendum. Praesent consequat nulla vitae turpis eleifend condimentum. Aliquam nec sollicitudin mauris. Nunc eu faucibus erat. Donec a risus quis erat rutrum varius. Etiam ultrices vehicula metus, in euismod arcu tempus ut. Aliquam vel ipsum accumsan, ornare nisi sed, facilisis massa. Mauris vitae orci vitae nibh porttitor interdum. Etiam sit amet dolor elementum, euismod est ac, venenatis risus. Aenean lobortis dui in magna accumsan, vitae consectetur diam pretium. Suspendisse in pharetra enim, nec aliquam felis. Morbi interdum lobortis blandit. Cras eu ante eu ante venenatis suscipit.

                        </p>
                        <a href="#" class="button">Read More</a>
                    </div>
                </div>
                <div class="right-image">
                        <img src="fabric.jpg" alt="Image" class="image">
                </div>
        </section>
        <section class="image-text-section">
            <div class="right-content">
                <div class="content-inner">
                    <h3 class="title">Our Process</h3>
                    <p class="text">
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam vitae commodo ipsum. Sed auctor varius feugiat. Praesent quis est eget mi commodo elementum. Praesent sed orci et dolor dictum consectetur ut vitae est. Nam euismod tempor est, non blandit magna dictum id. Nullam et hendrerit nisi. Mauris sed porta velit, eget semper magna. Maecenas lobortis purus vitae elit iaculis hendrerit. Etiam scelerisque ac sapien eget posuere. Sed nec orci ut purus accumsan sodales. Sed suscipit euismod dapibus. Maecenas eget neque gravida, tempus odio id, accumsan turpis. Suspendisse nec quam quis odio egestas tristique.
                    </p>
                    <a href="#" class="button">Read More</a></answer2>
<exanswer2><div class="answer accepted" i="77229217" l="4.0" c="1696408431" a="SGFybGV5IFVycXVoYXJ0" ai="13315244">
<p>I have come to realize that by looking at the problem from a different perspective and applying a simple margin adjustment to the .content-inner element, I was able to address the issue effectively.</p>
<pre><code><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Image with Text</title>
<style>
    * {
        box-sizing: border-box;
        margin: 0;
        padding: 0;
    }

body {
    font-family: Arial, sans-serif;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 40px; /* 40px padding on both sides */
}

.image-text-section {
    display: flex;
    margin: 80px 0;
}

.left-content, .right-content {
  flex: 1;
    position: relative;
}

.content-inner{
    position: relative;
    z-index: 2;
    margin-top: 160px;
    margin-bottom: 320px;
    padding: 40px;
    background-color: #fff;
    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.1);
}

.left-content,
.left-image { order: 1; }

.right-content,
.right-image { order: 2; }

.left-content .content-inner{ 
    transform: translateX(120px);
}

.right-content .content-inner{ 
    transform: translateX(-120px);
}

.right-image, .left-image {
    flex: 1;
    overflow: hidden;
    position: relative;
    width: 100%;
    object-fit: cover;
}

.image {
    width: 100%;
    height: auto;
    min-height: calc(100% + (3 * 160px)); /* Set min-height based on content height + 3 times 160px */
    object-fit: cover;
}

.title {
    font-size: 64px;
    margin-bottom: 10px;
}

.text {
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.button {
    display: inline-block;
    background-color: #007BFF;
    color: #fff;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
}

    </style>
</head>
<body>
    <div class="container">
        <section class="image-text-section">
                <div class="left-content">
                    <div class="content-inner">
                        <h3 class="title">Our Process</h3>
                        <p class="text">
Nunc ultrices nisi vel ultricies aliquam. Nulla arcu dui, posuere quis eros eget, convallis maximus purus. Nulla sed urna et orci ultrices bibendum. Praesent consequat nulla vitae turpis eleifend condimentum. Aliquam nec sollicitudin mauris. Nunc eu faucibus erat. Donec a risus quis erat rutrum varius. Etiam ultrices vehicula metus, in euismod arcu tempus ut. Aliquam vel ipsum accumsan, ornare nisi sed, facilisis massa. Mauris vitae orci vitae nibh porttitor interdum. Etiam sit amet dolor elementum, euismod est ac, venenatis risus. Aenean lobortis dui in magna accumsan, vitae consectetur diam pretium. Suspendisse in pharetra enim, nec aliquam felis. Morbi interdum lobortis blandit. Cras eu ante eu ante venenatis suscipit.

                        </p>
                        <a href="#" class="button">Read More</a>
                    </div>
                </div>
                <div class="right-image">
                        <img src="fabric.jpg" alt="Image" class="image">
                </div>
        </section>
        <section class="image-text-section">
            <div class="right-content">
                <div class="content-inner">
                    <h3 class="title">Our Process</h3>
                    <p class="text">
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam vitae commodo ipsum. Sed auctor varius feugiat. Praesent quis est eget mi commodo elementum. Praesent sed orci et dolor dictum consectetur ut vitae est. Nam euismod tempor est, non blandit magna dictum id. Nullam et hendrerit nisi. Mauris sed porta velit, eget semper magna. Maecenas lobortis purus vitae elit iaculis hendrerit. Etiam scelerisque ac sapien eget posuere. Sed nec orci ut purus accumsan sodales. Sed suscipit euismod dapibus. Maecenas eget neque gravida, tempus odio id, accumsan turpis. Suspendisse nec quam quis odio egestas tristique.
                    </p>
                    <a href="#" class="button">Read More</a>
                </div>
            </div>
            <div class="left-image">
                    <img src="fabric.jpg" alt="Image" class="image">
            </div>
    </section>
    <section class="image-text-section">
        <div class="left-content">
            <div class="content-inner">
                <h3 class="title">Our Process</h3>
                <p class="text">
Nunc ultrices nisi vel ultricies aliquam. Nulla arcu dui, posuere quis eros eget, convallis maximus purus. Nulla sed urna et orci ultrices bibendum. Praesent consequat nulla vitae turpis eleifend condimentum. Aliquam nec sollicitudin mauris. Nunc eu faucibus erat. Donec a risus quis erat rutrum varius. Etiam ultrices vehicula metus, in euismod arcu tempus ut. Aliquam vel ipsum accumsan, ornare nisi sed, facilisis massa. Mauris vitae orci vitae nibh porttitor interdum. Etiam sit amet dolor elementum, euismod est ac, venenatis risus. Aenean lobortis dui in magna accumsan, vitae consectetur diam pretium. Suspendisse in pharetra enim, nec aliquam felis. Morbi interdum lobortis blandit. Cras eu ante eu ante venenatis suscipit.
Nunc ultrices nisi vel ultricies aliquam. Nulla arcu dui, posuere quis eros eget, convallis maximus purus. Nulla sed urna et orci ultrices bibendum. Praesent consequat nulla vitae turpis eleifend condimentum. Aliquam nec sollicitudin mauris. Nunc eu faucibus erat. Donec a risus quis erat rutrum varius. Etiam ultrices vehicula metus, in euismod arcu tempus ut. Aliquam vel ipsum accumsan, ornare nisi sed, facilisis massa. Mauris vitae orci vitae nibh porttitor interdum. Etiam sit amet dolor elementum, euismod est ac, venenatis risus. Aenean lobortis dui in magna accumsan, vitae consectetur diam pretium. Suspendisse in pharetra enim, nec aliquam felis. Morbi interdum lobortis blandit. Cras eu ante eu ante venenatis suscipit.
                </p>
                <a href="#" class="button">Read More</a>
            </div>
        </div>
        <div class="right-image">
                <img src="fabric.jpg" alt="Image" class="image">
        </div>
</section>
    </div>
</body>
</html>

Although the formatting has changed, it effectively resolves the issue I was encountering and gets to the root cause. I will make sure to refactor it before implementing it in production.

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

What is the best way to prevent right floated DIVs from interfering with each other's positioning, specifically within a specified space?

Despite feeling like this question may have been asked numerous times before, I've searched high and low for an answer to no avail - both here and on Google. My HTML page has a maximum width that limits the size of the content. This content includes ...

Problem with Jquery Sticky Navigation

I've been struggling to understand this issue and can't seem to find any help. http://fiddle.jshell.net/DQgkE/7/show/ The user experience is currently a bit glitchy, but what I would like is: 1) When scrolling down the page, I want the Sticky ...

Tips for reducing a table to fit the dimensions of a mobile device

My Bootstrap table design looks great on larger screens like laptops, monitors, and tablets, but the size isn't optimized for phones. I've tried adjusting the width in percentages and pixels, but it's not working out. Any suggestions on how ...

The presence of an image within an HTML anchor is causing an unexpected artifact to

Currently, I am working on a simple header design, but there seems to be a strange issue with the anchors containing image tags. The problem can be seen in the screenshot below: Image Link Here is the HTML structure: <div class="block-content"> ...

Equal Sized <li> elements within Bootstrap Cards

I've been working with the following "template", and there are multiple cards like this on the settings page I'm currently developing. <!-- Card template --> <div class="card mt-3 shadow-sm"> <div class="card-hea ...

Selenium encountering difficulty extracting data via VBA with error message "NoSuchElementError"

Hello everyone, I'm new here on StackOverflow and seeking some assistance. I am attempting to extract data from a table on a website using Selenium for the first time. However, I encountered an issue while trying to use FindElementByClass as it return ...

Floating action button within a collapsible panel

I am having trouble placing a fixed-action-btn inside a collapsible body. It keeps appearing in the bottom right corner of the page instead of within the collapsible itself. How can I ensure that the button stays inside the body? Check out this link for r ...

Creating a personalized error page with the .htaccess file

I want to create personalized error pages for different errors This is the layout of my directory: .htaccess error_pages: error_400.html error_401.html error_404.html ...

Steps for updating the <option> selection in the third <select> menu when the second <select> menu changes, with the second menu being populated by altering the value of the first dropdown through jQuery AJAX

I'm facing a unique situation in my school management project and have been unable to find a solution online. Here's the issue: I have three <select> elements - the first one is for selecting a class, the second one is for selecting a secti ...

Preventing Multiple Form Resubmissions in PHP

I have multiple forms that require navigation from the initial form to the final form. Each form includes both 'NEXT' and 'BACK' buttons for moving forward and backward in the process. I am looking for a way to prevent the confirmation ...

Show the HTML page returned by the server on the client side

Hey there! I've come across a PHP code snippet that sends back an HTML file as a response. This PHP code makes use of the include method to send the file. When I'm on the client side, I'm employing AJAX. Upon typing console.log(data) (with ...

Tips for keeping two row headers in place on a table while scrolling:

Check out my fiddle here: https://jsfiddle.net/oed1k6m7/. It contains two td elements inside the thead. thead th { position: -webkit-sticky; /* for Safari */ position: sticky; top: 0; } The code above only makes the first row fixed. How can I make b ...

Refine your search by focusing on select characteristics of an item

Is there a way to filter tasks in a table using only specific attributes provided in the table? Currently, when I enter a search term in the search bar, tasks are displayed even if they have attributes that match the input but are not displayed in the na ...

Enhance your calendar with sleek jQuery styling

Currently, I am utilizing the jQuery-ui.css (smoothness) solely for the calendar CSS. Can anyone provide me with a comprehensive list of all the calendar CSS functions available in it? I'm looking to avoid using any unnecessary CSS that might be causi ...

What is the best way to add content to a box once it has been hovered over?

Looking to create a sticky note-style design, but struggling with displaying the content inside the box only when hovered. In my code example below, can you help me achieve this effect? body { margin: 45px; } .box { display:inline-block; backgrou ...

Overflow scrollbars do not appear on flex divs

I am struggling with implementing a simple flex container that contains standard divs. The issue I am facing is that the overflow does not display a vertical scroller as desired. In order to achieve this, I have included the following CSS code snippet: #c ...

JavaScript popup menu with a redirect URL

I utilized Tinybox from this source for launching a popup webpage. I am hoping that when I click the links on the webpage, the popup will close itself and redirect to the link's URL. Here are my JavaScript and HTML codes: <script type="text/java ...

"Ensuring a mobile-friendly website menu's z-index is

I'm currently working on developing a responsive menu, but I've encountered some issues with setting the correct Z-index values. The problem arises when trying to add a "show menu" button that expands behind the main content (cwrap) after window ...

Show results from selecting multiple dropdown options

I am looking to create a search function that displays results based on multiple dropdown selections. I have 4 dropdown menus and a submit button, but I am unsure how to show the search results upon clicking the submit button. The desired outcome is to dis ...

How to effortlessly bring modal windows onto the page from either side

I'm looking to have two hidden modal windows that can slide in from the left and right edges of the page. In my current setup, the left modal slides in from the right instead of sliding out from the left margin as desired. You can view the issue in th ...