Having trouble with custom CSS <li> positioning within a media query, it's not performing as anticipated

I have customized the alignment of li tags for a CSS media query. Take a look at this JFiddle to see how it should appear:

https://jsfiddle.net/4fwx7rbj/1/

The li elements are centered within their container, and the text is aligned with the list images. I attempted to implement this in a media query scenario as well:

https://jsfiddle.net/ro7gj60h/

The goal is for the .half-width div to take up 100vw while maintaining the alignment of the list like in the initial snippet. Unfortunately, it's not working as expected. Can someone provide guidance on what might be missing?

Thank you.

Here's a quick overview of the HTML structure:


    <div class="container">
        <div class="half-width section3">
            <div class="half-width-content">
                <div class="middle-text">
                    <h2>A Headline</h2>
                    <p>
                        Some paragraph
                    </p>
                    <div class="list-div" id="A">
                        <ul class="items-list" id="list">
                            <li class="animation-listener">This is a list item</li>
                            <li class="animation-listener">This is a list item</li>
                            <li class="animation-listener">This is a list item</li>
                            <li class="animation-listener">This is a list item</li>
                        </ul>
                    </div>
                    <img class="hand-writing-img" src="https://fakeimg.pl/498x50/?text=this is some image">
                </div>
            </div>
        </div>
    </div>

Answer №1

When the screen size is between 500px and 768px, the CSS rule in .list-div {} will make the unordered list (ul) smaller using display flex.

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

The onclick handler fails to function following the injection of html using jquery AJAX

After using ajax to inject HTML into my page, the onclick handler on a specific part of that injected HTML does not seem to be functioning... Specifically, I am referring to this image... < img class="close_row" src="img/close.gif"/> In jQuery, I ...

Creating a top-notch design with a standard app vibe (Material Design)

For the past year, I have been using Cordova to create apps by converting HTML, JavaScript, and CSS code into .apk files. However, I have struggled to achieve the same level of professionalism and "normal" feel that popular Android apps like WhatsApp posse ...

Extract information from SQLite in the form of an array, then use Chart.js within an HTML file to create visually appealing charts based on

I am in the process of developing a web app that requires data visualization on a single page. The data for generating visuals is sourced from an SQLite database located locally on my machine. According to the documentation provided by Chart.js, it accepts ...

The sluggish loading speed of the page is being caused by both jQuery and an external file containing Amazon

I am facing an issue with my website where it is loading over 1000 images per page from Amazon servers. To enhance the functionality, I have integrated jQuery plugins that are stored locally on the webserver, without using any remote JS or CSS. However, ...

What could be causing my JSON product list to not load properly?

My list is not loading and I can't figure out why. I've included my json, jquery, and HTML below. The console isn't showing any errors, but the list is still blank. Any help would be greatly appreciated as I am new to working with json. Than ...

Adjusting my menu layout causes my header image to be partially covered

I've been trying to make my menu fixed at the top of my website, but it keeps overlapping into my header image and doesn't look right. I've experimented with different solutions, but nothing seems to work. Here's the CSS code I used th ...

Scroll the div back to the top when the form is submitted

I have set up a form in a pop-up using Bootstrap modal. The form is quite long, so after submission, the message appears at the top of the form. However, I want it to scroll to the top when the user submits the form so they can easily see the message. Is ...

Arranging the Burgers on the Menu using Flexbox

I'm looking to develop a simple note-taking app, but I'm struggling to figure out how to place a burger menu on the right side of a flexbox. Below are my JS and CSS files: JavaScript / HTML <div className={styles.wrapper}> < ...

Detecting Pixel Colors Across Multiple Overlapping Canvases

I have a challenge with multiple canvas elements on my webpage. I am trying to retrieve the pixel color of all overlapping canvas elements when they are stacked on top of each other. Let me illustrate with an example below. In this scenario, I am attempt ...

Tips for adding a border to an element when hovered over

I am looking to achieve a hover effect that displays a border around an element without actually adding the border to the element itself, as shown in this image: https://i.sstatic.net/iFpCA.png The challenge I'm facing is that I want to allow users ...

What is the best way to showcase a dynamic amount of items using radio buttons in an HTML form?

DataFile.json: {"elements":[{"id":1,"name":"apple"},{"id":2,"name":"banana"},{"id":3,"name":"orange"}]} Goal: Utilize PHP to read DataFile.json, delete selected elements from the array, and save the changes. Approach: After reading the file and displayin ...

The perplexity surrounding the functionality of th and tr tags is causing confusion in

Below is the code snippet I have in my HTML table. <table> <tbody> <thead> <tr> <th align="right" colspan="4"> <span class="font-style-bold">SCHEDULE OF RATES</span> ...

Conceal rows in a table that are not selected using Jquery when the table has been loaded from a given URL

Below is the HTML code for an user search input field and the results table: <div class="input-group"> <input type="text" id="q" class="form-control" placeholder="Search for User"> <span class="input-group-btn"> ...

Having difficulty attaching data in Angular 2

I am attempting to populate the countries data into my px-component, which happens to be a typeahead. You can find the Codepen link here. When I directly bind the data in HTML, the typeahead successfully suggests a list of countries. However, when I atte ...

What is the best method for developing a live text display switcher that works across different pages?

Hello everyone! I am currently in the process of creating a display toggler for my website. I have two separate pages, index.html and toggler.html. In index.html, the "TEXT" is displayed, while toggler.html contains the actual toggler or switch button. Whe ...

Navigation bar not functioning properly due to stickiness

I am currently working on a project where I need to apply a 'fixed' class to a menu when the user scrolls down to that section. While I have successfully implemented this feature, I am facing difficulties in removing the class once the user scrol ...

Modifying the image height in a column using Bootstrap and JSON data

My webpage is dynamically generating images from a JSON file through a JavaScript file. However, the images are displaying at different heights, and I want each column to adjust to the height of the image to eliminate any gaps. Particularly, data with the ...

Tips for customizing a button's font with CSS

Update: I have noticed that the issue mentioned in this question is specific to OS X browsers. I am looking to modify the font style of my input buttons using CSS, similar to the following: input[type="button"] { font: italic bold 3em fantasy; } How ...

Acquiring the content of elements contained within a div container

On a webpage, I have included multiple div elements with unique IDs and the following structure: <div class="alert alert-info" id="1"> <p><b><span class="adName">Name</span></b><br> ...

Resolving the Smooth Scrolling Problem

Here is a simplified version of what I am currently working on: Although I have managed to get the scrolling functionality to work, there seems to be an issue with transitioning from one section to another. For example, when clicking on NUMBER 3, it s ...