item in the list that is clickable and has a background image:

I need help with creating clickable images inside list items (<li>). Currently, only the bottom half of the image is clickable. I've tried different approaches and explored jquery solutions, but I'm looking to achieve this using pure CSS.

<div class="link">
  <ul>
    <li>
      <a href="url">
        <img src="image">
      </a>
    </li>
  </ul>
</div>

.link {
    white-space: nowrap;
    text-align:center;
}
.link li {
    max-width: 23.3%; 
    display: inline-block;
    text-align: center;
    vertical-align: middle;
}
.link img {
    max-width:100%;
}

Answer №1

To ensure the images are properly wrapped within the a link, include display:inline-block and set both height:100% and width:100%.

Answer №2

Upon further investigation, I discovered a significant issue. The header on my site was actually overlapping with that specific area.

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

Firefox: Issue with CSS aspect ratio not being supported in Firefox, unlike Chrome which works correctly

For my application, I am utilizing the display: grid property. My goal is to have the grid items always maintain a square shape by applying an aspect ratio of 1/1. While this works perfectly in Chrome, Firefox seems to ignore the aspect ratio code. Even co ...

An issue has occurred while parsing the XML data, causing the document to not be properly formatted. As a result

Hey everyone, I'm currently working on an HTML/JavaScript project and have encountered a problem. There's a button in my code that is supposed to redirect to another page on my website, but when I click it, I receive the following error: XML Pars ...

Tips for seamlessly hiding display images with HTML

In my quest to create a basic image slider, I've managed to achieve it using a combination of JavaScript and HTML. Take a look at the code provided below. I've included all the necessary codes for clarity's sake. However, the issue arises w ...

Tips for including text and a button within the footer of a Bootstrap modal

I'm facing an issue with my Bootstrap modal footer where the output shows two divs side by side, which is not the desired result. Below is the code snippet in question: <div class="modal fade" id="itiModal" role="dialog&quo ...

generate an electronic communication using an HTML and PHP template

Currently, I am working on a PHP web application that requires sending emails in HTML format. To achieve this, I am utilizing the mail() function. My goal is to send emails based on a template file that is formatted in HTML and includes segments of PHP ...

Creating a dynamic animation for a navigation bar's underline

I'm attempting to add a smooth underline effect to the links in my navbar when they are hovered over. Unfortunately, the entire ul element is being underlined instead of just the selected link. Is there a way to resolve this issue? a { text-deco ...

Add fresh inline designs to a React high-order component creation

Applying a common HOC pattern like this can be quite effective. However, there are instances where you may not want a component to be wrapped, but rather just extended. This is the challenge I am facing here. Wrapper HOC const flexboxContainerStyles = { ...

The URL in $.mobile.changePage has not been updated

One of the challenges I encountered was switching between two pages - a menu list page and a menu detail page. The transition from the menu to the menu detail page was achieved using $.mobile.changePage. While everything seemed to be working correctly, the ...

Having trouble customizing my navigation bar with the provided classes for navigation bar styling

My current project involves creating an ecommerce site using HTML and CSS. I utilized a navigation bar template from Bootstrap, but I'm encountering difficulty in styling the .navbar-light .navbar-nav .nav-link classes. As a beginner, this is my first ...

If the content within a <div> element exceeds the available width, a horizontal scrollbar will be displayed

I have a scenario where I am using an absolute div to overlap another div. The div that overlaps is the absolute one (.content), and if the overlapped div (.left) doesn't fit the screen width, a horizontal scroll bar does not appear. How can I automat ...

What is the best way to manage these interconnected Flexboxes when using align-items: stretch?

Trying to put this into words is quite challenging, so I created a simple diagram for better understanding: https://i.stack.imgur.com/TMXDr.png The outer parent uses flex with align-items:stretch to ensure that both col 1 and col 2 have the same height. ...

Declare webpage as manager for mailto links

One interesting feature I've observed in various web-based email providers is the ability to add the website as the default mailto links handler in browsers like Firefox and Chrome. This means that when clicking on a mailto: link, it will automaticall ...

Is the form being submitted with the href attribute?

Does this code ensure security? <form id="form-id"> <input type='text' name='name'> <input type='submit' value='Go' name='Go'/></form> <a href="#" onclick="docume ...

Unable to display the outside table border in CSS styling

Lately, I've been relying on 'border = 1' in my HTML for styling, but I've come to the realization that using CSS would be more efficient. So, I went ahead and created a simple border class like this... .basicborder table, .basicborder ...

"JavaScript that doesn't rely on a specific browser

Why does this code behave differently across browsers? What modifications are needed to ensure consistent behavior in all of them? In Firefox, it functions correctly, using the URL /some/path/?searchedText=sometext. However, in IE, nothing happens when cli ...

Tips for showing background image in case of incorrect URL pattern

Mapping in web.xml <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> Error handling with ErrorHandler servlet RequestDispatcher vie ...

When trying to show a Vue view, there was an issue with reading properties of null, specifically the 'style' property

I am experiencing an issue with a header that has an @click event in the body. Instead of displaying a Vue view upon clicking, I am encountering the following error: Cannot read properties of null (reading 'style') Upon researching on Stack Ove ...

Creating a Dynamic Canvas Rendered to Fit Image Dimensions

I'm struggling with a piece of code that creates an SVG and then displays it on a canvas. Here is the Jsbin Link for reference: https://jsbin.com/lehajubihu/1/edit?html,output <!DOCTYPE html> <html> <head> <meta charset=&qu ...

Viewing the html page from a virtual directory seems to be functional in Internet Explorer, but appears to be malfunctioning when accessed

localhost/rupeshwebsite/RJ.htm the URL functions properly in Internet Explorer. I am currently working on a Windows application using C#. The application is being developed as a general one, with scripts provided in a Notepad file for users to place in t ...

Click here to navigate to the anchor and expand the accordion

Is there a way to open an accordion panel using an external anchor link? I attempted to use an anchor link, but it only loads the page without opening the panel. My goal is to have the page load, scroll to the panel, and then open the accordion when the ...