Adjust the dimensions of a specific image in a lineup

I'm currently in the process of developing a website and I've encountered an issue with lists. Specifically, I'm trying to make one particular image within the list slightly larger as it appears smaller compared to the others.

For visual reference, here's the image: https://i.sstatic.net/hd6kh.jpg

To achieve the layout of stacking three images on top and below each other, I have divided them into two separate lists; one for the top three and another for the bottom three. This is where I believe the problem lies.

I attempted to use the following CSS code to address the issue (note that I used 2px to demonstrate the effect):

.white-container ul li:nth-child(3) img {
    width: 2px;
}

Using this code generated the following outcome: https://i.sstatic.net/yU2xu.jpg

Here is the HTML code snippet:

<div class="white-container">
        <div class="container">
            <div>
                <ul class="firstthree">
                    <li>
                        <img src="images/brush.svg" class="brush" alt="brush">
                        <p class="brush">Graphic Design</p>
                    </li>
                    <li>
                        <img src="images/wand.svg" class="wand" alt="wand">
                        <p class="wand">UI Design</p>
                    </li>
                    <li>
                        <img src="images/code.svg" class="code" alt="code">
                        <p class="code">Front-end Dev</p>
                    </li>
                </ul>
            </div>

            <div>
                <ul class="secondthree">
                <li>
                    <img src="images/settings.svg" class="settings" alt="settings">
                    <p class="settings">Back-end Dev</p>
                </li>
                <li>
                    <img src="images/database.svg" class="database" alt="databases">
                    <p class = "database">Databases</p>
                </li>
                <li>
                    <img src="images/mobile.svg" class="mobile" alt="mobile">
                    <p class="mobile">Mobile Devices</p>
                </li>
            </ul>
            </div>
        </div>
    </div>

I don't want the image at the bottom right to change. I'm struggling to find an alternative solution. I also tried using:

.white-container ul firstthree li:nth-child(3) img {

thinking it would work, but unfortunately, it didn't produce the desired result. Any advice or assistance would be greatly appreciated. Thank you!

Answer №1

Start off by consolidating your two lists into a single list, as they are closely related in meaning.

<ul>
    <li>
        <img src="images/brush.svg" alt="brush">
        <p>Graphic Design</p>
    </li>
    <li>
        <img src="images/wand.svg" alt="wand">
        <p>UI Design</p>
    </li>
    <li>
        <img src="images/code.svg" alt="code">
        <p>Front-end Dev</p>
    </li>
    <li>
        <img src="images/settings.svg" alt="settings">
        <p>Back-end Dev</p>
    </li>
    <li>
        <img src="images/database.svg" alt="databases">
        <p>Databases</p>
    </li>
    <li>
        <img src="images/mobile.svg" alt="mobile">
        <p>Mobile Devices</p>
    </li>
</ul>

After that, instruct the browser to present the list in a grid layout.

ul {
    display: grid;
    list-style: none;
    grid-template-columns: repeat(3, 1fr);
}

You can then utilize flexbox within each cell to align the elements vertically (

ul > li { display: flex; flex-direction: column; }
). The remaining adjustments are up to you to make.

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 base64 code generated by the toDataURL method on the canvas appears to be incorrect

I am facing an issue with my code while using canvas to draw a cropped image with base 64. The problem is that it works perfectly on Chrome but gives me a blank image on Firefox. async function base64SquareCrop(imgbase64, size = 224) { const img = docume ...

When Python / Django's render_to_string function is used, the output is rendered as text containing HTML entities

A task I am working on involves migrating a Python/Django application from: Django==1.5.1 Python version 2.6.6 To: Django==3.2 Python version 3.6.8 One issue I am encountering is with a section of code that generates an HTML template as a string and add ...

The issue of HTML form not displaying within a Java servlet environment

While following a basic tutorial to learn Java servlet programming in Eclipse, I encountered an issue with the browser not rendering the submit button in the HTML form. Despite reviewing the code multiple times, making small modifications, and even double- ...

Undefined error encountered in the Google Places library

I'm new to working with the Ionic framework and was experimenting with implementing an autocomplete search feature using the Google Maps API. After going through several resources, I included the following code: <script type="text/javascript" src ...

Attach an event listener to a particular textarea element

Currently, I am developing a project in Next.js13 and my focus is on creating a custom textarea component. The goal is to have this component add an event listener to itself for auto-adjusting its height as the user types. Below is the relevant section of ...

Showing an image on a blurred background-image at the top of the webpage

Is it possible to overlay an image on top of another image, with the top image appearing blurred in the background? .background-image { background-image: url('https://images.pexels.com/photos/366968/pexels-photo-366968.jpeg?w=1153&h=750&a ...

JSFiddle Functioning Properly, But Documents Are Not Loading

My JSFiddle is functioning properly, but the files on my computer aren't. It seems like there might be an issue with how they are linking up or something that I may have overlooked. I've checked the console for errors, but nothing is popping up. ...

The overlay background is not covering the entire height of the container

The CSS includes a .wrapper with the style min-height: calc(50% - 30px), along with an overlay blur div to cover the entire height of the .wrapper element. Here's a link to a Codepen example showcasing this setup: https://codepen.io/palaniichukdmytro/ ...

Issue with display of Favicon in Google Chrome browser

My favicon is not appearing on my Chrome tab, even though I've checked multiple articles and confirmed that the code is correct. It does show up in Firefox, so I'm confused as to why it's not working in Chrome. I've cleared my cache and ...

Crystal report for VS2010 displays scrollbars on the page

I like to present my report in a div container with overflow:scroll I have placed the crystal report viewer inside the DIV and expect it to stay within the div only, which it does. The div shows scroll bars when the report overflows. However, my page als ...

Has a newly created element been styled or are all values set to default since it is outside of the DOM?

First, I begin by creating an element: let link = document.createElement('a'); After my document is fully loaded and all styles and scripts are applied. The styles may look something like this: a { background-color: salmon; } Therefore, it w ...

What are some ways I can ensure my webpage remains consistent and user-friendly when scrolling, rather than appearing distorted and jumbled?

Is there a way to automatically scroll my page when the window is at a small height, instead of adjusting it to the height by squeezing it? I've tried using overflow in different ways, but haven't been successful in getting the entire page to scr ...

The function .innerHTML is not functioning correctly, at least in my opinion

When I utilize .innerHTML to insert text into a textarea, the script stops functioning if I manually begin editing the text in the textarea. Here is the code snippet: (function($){ addPort = function(name) { switch(name) { case 'name1': ...

I am facing an issue with my Bootstrap 4 Navbar as it is not collapsing in the Mobile View

The issue I am facing is that the navbar options cannot be opened properly. When clicked, it appears as a solid button and forms a sort of ring around it. I have attempted various solutions such as adding and removing scripts, changing the navbar attribute ...

Enhancing quiz results with intricate input forms using JavaScript

I am currently working on an online quiz and the code is functioning properly. However, I would like to display the scores of each user. As a beginner in Javascript, I have been developing this quiz for a friend, and it has been a learning experience for m ...

Why is my DIV not registering clicks when I try to interact with it?

Trying to implement a Javascript click event <script type="text/javascript"> $(document).ready(function () { $(".role").click(function () { alert("idiot"); }); }); </script> Here is the CSS code for styling the DIV with clas ...

Can jQuery be used to change the functionality of a submit button, such as toggling between show, hide, and submit options?

I am having trouble toggling a button to either submit a form on click or reveal an input field, depending on whether the user clicks outside the input field to hide/collapse it. The issue arises when the user dismisses the input field and the submit butto ...

Finding the Perfect Placement for an Element in Relation to its Companion

Is there a way to achieve an effect similar to Position Relative in CSS using jQuery? I have developed a tooltip that I want to attach to various objects like textboxes, checkboxes, and other text elements. My code looks something like this: <input i ...

Using JQuery to automatically scroll and anchor to the bottom of a dynamically populated div, but only if the user doesn't

I am attempting to achieve the functionality of automatically scrolling to the bottom of a div with the ID #chat-feed. The overflow for this div is set to auto, and I want it to remain at the bottom unless a user manually scrolls up. If they do scroll up, ...

The issue with grunt-contrib-compass not functioning properly within npm

I recently installed npm and grunt, followed by installing grunt-contrib-compass. However, when I try to run grunt, I encounter the following error: Running “compass:dist” (compass) task Warning: not found: compass Use –force to continue. Aborted du ...