Just dipping my toes into HTML and CSS, noticing that links start to shift around when hovered over

I am struggling to create 3 images that double as links to other pages. However, whenever I hover over them, they seem to shift out of place.

Can anyone offer some guidance?

This is my CSS code for the second media query, and I want it to be applied universally.

#section_container_bottom figure {
    width: 100%;
    margin: 0 auto;     
    }

#section_container_bottom img {
    width: 25%;
    margin: 3%;
    }

#section_container_bottom img a:link,
#section_container_bottom img a:visited,
#section_container_bottom img a:active,
#section_container_bottom img a:hover {
        display: block;
        }

Below is my HTML structure:

<section id="section_container_bottom">
    <figure>
        <a href="javascript:void(0)"><img src="Sources/USE/latest-colors.png" alt="An overview of the latest colors available at Paint Republic"></a>
        <a href="javascript:void(0)"><img src="Sources/USE/inspiration.png" alt="Some inspiration provided by Paint Republic for you when looking to repaint in your own home"></a>
        <a href="javascript:void(0)"><img src="Sources/USE/color-expert.png" alt="Contact one of the color experts that are available through Paint Republic"></a>
        <div class="clear_float"></div>
    </figure>
</section>

Could the issue lie with the display property being set to block?

Answer №1

Kindly update the line of code in your CSS stylesheet

CSS Code:

#section_container_bottom a:link, a:visited, a:active, a:hover {
  display: inline;
}

Answer №2

Make sure to include CSS selectors again after a comma.

#section_container_bottom img a:link,
#section_container_bottom img a:visited,
#section_container_bottom img a:active,
#section_container_bottom img a:hover {
    display: block;
}

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

Looking to incorporate a pre-checked checkbox using Angular Material

I'm facing an issue with the following code snippet: <ng-container matColumnDef="Estado"> <th mat-header-cell *matHeaderCellDef>Estado</th> <td mat-cell *matCellDef=""> <mat-checkbox *ngIf ...

Utilize z-index for overlapping dynamic divs, including those that are nested

There are two div elements nested within each other. The first div is nested inside the second one. To view this issue, click on the following: link to fiddle My dilemma is that the red div (div1) shifts around within div2, and I would like div1 to disa ...

Once the final row in the table is removed, the width of the second cell in the top row will be set to 0

Can anyone help with an issue I'm having on my website? I created a basic web page with some Javascript that allows for inserting and deleting table rows. However, I've noticed that in IE6, when I delete the last inserted row, the second cell of ...

"What is the best way to switch between multiple data targets and toggles in bootstrap using the HTML data toggle attribute

I am currently coding an animated hamburger icon for the Bootstrap navbar, and I need to find a way to toggle both the hamburger icon and the responsive navbar. Is there a method or code snippet that allows me to toggle these two elements independently usi ...

Update the output paragraph in an HTML dropdown list

Within my HTML code, there is a dropdown list followed by a paragraph. Inside the dropdown list, I have included options for various animals - Dog, Cat, Mouse, and Bird. When someone selects 'Cat' from the dropdown list and presses submit, I wan ...

What is the best way to incorporate a Django variable as the width parameter in a style tag within HTML?

I'm attempting to utilize a Django variable as the percentage width value within a style tag in HTML, but it's not functioning correctly. Strangely, I've discovered that using curly braces {} within style tags is prohibited—this contradict ...

Display the data from the database in a label based on the selection made in the combo box

In an attempt to pass values into a label based on the selected option from a combobox, let's say if I choose A, the label should display 1 and if I select B, it should display 2. Here is my code: kota.php: $conn = mysql_connect('localhost&apo ...

A visually stunning image showcase with dynamic resizing and strategically placed white spaces using the m

I'm attempting to create a responsive image gallery using the Masonry jQuery plugin, but despite reading numerous articles and forum posts on the topic, I can't seem to get it to work properly. The gallery is displaying many blank spaces. My app ...

The modal box should adjust its height to perfectly accommodate the content within

I'm in the process of developing a straightforward modal (popup) window, using as few lines of code as possible... just the basics. The modal has a maximum width of 650px and its height adjusts to fit the content. In case the content exceeds the avai ...

Adjusting the object-fit property to "contain" and combining it with border-radius or exploring other alternatives can enhance

My goal is to showcase videos on a webpage while utilizing border-radius to round the corners for a more aesthetically pleasing look. The challenge arises as the videos come in varying aspect ratios, requiring them to be accommodated within containers wit ...

Updating the background of a div in HTML through the power of JavaScript

I am having trouble changing the background of a DIV. I believe my code is correct, but it doesn't seem to be working. I suspect the error lies with the URL parameter, as the function works without it. Here is my code: <script language="JavaS ...

HTML is appearing as unformatted text on the screen

I am utilizing deta for rendering cloud-based HTML content. Below is the code snippet in use: from deta import Deta from fastapi import FastAPI, Request, Response, Form, File, UploadFile from fastapi.templating import Jinja2Templates from fastapi.response ...

Resolved problem with z-index and fixed positioning in the mobile version of Safari

Is there an issue with the site here: The primary content scrolls up over the countdown and under the navigation, both of which are fixed elements. This functions correctly on desktop, but on mobile Safari, the content scrolls behind the countdown when th ...

The CSS transformation is being overridden

Having an issue where I have two functions that both apply a CSS transform to an element using jQuery, but they end up overwriting each other. These functions are called at different times and have no knowledge of each other. An example showcasing the pro ...

Padding on the left and right in Bootstrap

Here is the code snippet I'm working with: <div class="col-md-12 pt-5 let-top"> <h1>A</h1> </div> For small and extra small screens, I am looking to include padding on both the left and right sides. Can anyone help me wit ...

Forms for uploading and submitting multiple files

On my single page, I have several file upload forms that are generated in a loop. The issue is that the first file upload control works fine, but the others do not. <div> <form action="/docs/1046/UploadDocument?Id=1046&amp;propertyTypeId ...

Tips for swapping out a new line character in JavaScript

Hello! I'm currently facing a challenge with some code. I have a function designed to replace specific HTML character values, such as tabs or new lines. However, it's not functioning as expected. var replaceHTMLCharacters = function(text){ tex ...

XSLT: Tips for preventing the use of self-closing tags within HTML attributes

I am new to XSLT and I'm currently troubleshooting an issue with some XSLT code (version 2.0) that was written a few years ago. Here is a snippet of the XSLT code: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ...

``Change the color of the sections in a 3D pie chart on a Highcharts

I am looking to create a custom pie chart with two different colors: one for the main surface and another for the sides. Currently, I can only configure the lighter blue color for the main surface, but I would like to also change the darker blue color for ...

Ways to execute a JavaScript function upon a button click instead of during the page load completion

I searched on Google but couldn't find the answer, so I'm asking here for help. In the attached screenshot located at the end, when the user clicks on the download button, some backend actions are performed such as file transfer. Once the proces ...