When HTML anchors are placed over thumbnails, they can cause white stripes to appear underneath the

I have organized my thumbnails in an unordered list, but I'm encountering an issue where the anchor tag seems to overlap them, creating white stripes underneath. Below is the code I am currently using:

HTML:

    <div class="wrapper">
        <ul class="masonry">
           <li class="item">
              <a class=lightbox" href="1.jpeg">
                 <img alt="1.jpeg" src="thumb/1.jpeg">
              </a>
           </li>
        </ul>
    </div>

CSS:

.wrapper{
  width:90%;
  margin: auto;
  padding: 20px;
}
.masonry {
  column-count: 4;
  -moz-column-count: 4;
  column-gap: 0.5em;
  -moz-column-gap: 0.5em;
  -webkit-column-gap: 0.5em;

}
.item{
  background: #eee;
  display: inline-block;
  width: 100%;
  margin: 0 0 0.5em
  box-sizing: border-box;
  moz-box-sizing: border-box;
  webkit-box-sizing: border-box;

}
.item a{
  margin: 0;

}
.item img{
  width: 100%;
  margin: 0;

}

Example

You can observe the issue on my website

Answer №1

Apply the CSS property display: block to the element with the class of .image img

Take a look at this helpful answer

Answer №2

To eliminate the white strip, apply line-height: 0; to the selector .item img.

The presence of the white strip is due to the space reserved for descenders in letters. When the image is aligned with the baseline, this space remains visible; however, utilizing line-height: 0; will cause it to vanish.

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

Hidden bootstrap 4 custom checkbox issue

I tried to implement Bootstrap 4 custom control for a checkbox by following the documentation, but the checkbox isn't appearing. Can anyone spot what I might be doing incorrectly? <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css ...

Having trouble sending the information to Parse.com using the website

I am a beginner with the Parse database and I am currently working on implementing a code that allows users to sign up, with their information stored in the Parse database. However, I am encountering an issue where the values are not uploading as expected. ...

Discrepancy in the vertical pattern repetition of the SVG background

When I use a simple div with an SVG set as a background image with vertical repeat, I noticed a gap of varying sizes on Chrome and Firefox depending on the screen size (please resize the window). Check out the issue here .bg { width: 50%; height: 2 ...

``Is there a way to align content in the middle of the page while

Hey everyone, I need some help with centering the content on my webpage. The sidebar is always active and I want to make sure the main content is centered like the highlighted text. The issue is that it's currently centered based on the width of the e ...

Is there a way for me to set up a confirmation pop-up alert before hitting the submit

I am interested in implementing a pop-up alert that asks "Are you sure you want to delete this comment?" when a user clicks on a button. How can I achieve this? $('button').on('click', function(){ // Display an alert to the user c ...

Modify the input based on the chosen option operation

I am working on a project where I have 3 select elements and when a user selects an option, the associated value should be displayed in an input field. I am trying to use a single function for these 3 selects, but I am facing some issues. Here is the HTML ...

How can I wrap content with the <li> element in a cross-browser compatible way?

I am encountering an issue with the dropdown menu on my website located at . When hovering over elements with a dropdown menu, you may notice that some of the items within the dropdown span more than one line and have varying widths. My goal is to adjust ...

Difficulty with font rendering across different web browsers such as Firefox, Chrome, and Opera

Visit the following website: I have implemented font-face on my site: @font-face { font-family: 'SegoeUI'; src: url('{site_url}themes/site_themes/agile_records/fonts/segoeui.eot?') format('eot'), url(' ...

Tips for creating a seamless Bootstrap collapse effect

I have noticed a slight flicker in the content collapse when using this code. Is there a way to make it collapse more smoothly? <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"> <script ...

Floating unordered list items in a gallery display

I am dealing with a Gallery view where I am using the UL LI elements with float left to create a gallery-like layout with multiple lines based on the content. However, I am encountering an issue where after the first line, the layout seems to malfunction i ...

The default black border on the Material UI Modal disappears upon inspection after rendering

Thank you for sharing your thoughts on this topic. I am currently experimenting with the Material-UI Modal component. In the image below, you can see that there is always a black border displayed upon rendering. I have attempted to remove it using custom ...

Check to see if a value is present in JavaScript and proceed with submitting the form

I have a situation where I am trying to capture the browser location and post it to another page. The problem I'm facing is that JavaScript takes some time to retrieve the browser location, causing the form to be submitted before the location is obtai ...

Trouble with JavaScript loading in HTML webpage

<!DOCTYPE html> <html> <head> <title>Breakout Game</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <canvas width="900" height="450" class="canvas"></canvas> ...

Converting data from Random.org into an integer using JavaScript

I have been working on a small web application to experiment with CSS animations. Although it's functioning, I'm seeking more genuine randomness. To achieve this, I am exploring the use of Random.org. How can I import the output from Random.org i ...

Loading content onto a webpage

I have seen similar questions before, but I couldn't find a relevant answer that fits my requirements. My question is about how people create loading text on a webpage, where the text starts off in grey and gradually changes to white as the page loads ...

The functionality of changing the checkbox to "checked" by clicking on the span is not

How can I create a toggle button with a checkbox using css and jquery? Clicking on the span representing the toggle button should change the checked property of the checkbox. Currently, the span does not change the property, even though it triggers the c ...

Is it possible to vertically resize just one of three divs to match the size of the window?

I'm facing a challenge in creating a responsive webpage with multiple divs. Here is the structure I am trying to achieve: <div id="container"> maximum width of 1200 and height of 1000 <div id="vertically-static-top">20 pixels high< ...

items flexing to fill the width on larger displays

After completing my first web page using flexbox, I encountered an issue with the layout when viewed on a larger screen resolution (1894x787). The content appears stretched and distorted. Here are the screenshots for comparison: At 1326x768 https://i.sst ...

Using jQuery to access specific elements within the DOM by navigating through the document structure

I'm currently facing a challenge with using jquery's parents/siblings functions to locate specific input elements. Despite my efforts, I can't seem to get it right. Here is the HTML structure I am working with: <div id="ExtrasOptions"&g ...

Using a regular expression to replace text within a TextNode with a new DOM node

I am currently working on a function that preprocesses a Text Node within the HTML DOM. The main objective is to carry out interpolation or string templating. Essentially, the function examines occurrences that match the regular expressions /\${([^}] ...