Space between pixels at the bottom of a division

There's a puzzling issue here with a simple fix waiting to be uncovered. In the example below, a pixel gap has formed between the bottom of two images and the DIV elements (home-top or home-bottom). How can this bothersome space be eliminated?

.container{
    width:80%;
}

.menu{
    width:100%;
    background:black;
    color:white;
    text-align:center;
}

.home-top{
    background:white;
    overflow:hidden;
}

.home-bottom{
    background:#EEE;
    overflow:hidden;
}

.footer{
    width:100%;
    background:black;
    color:white;
}

.txt-left, .img-left{
    width:50%;
    float:left;
}

.txt-right, .img-right{
    width:50%;
    float:left;
}
<div class="menu">
    menu
</div>
<div class="home-top">
    <div class="container">
        <h1>home top</h1>
        <div class="txt-left">
            some text goes here.
        </div>
        <div class="img-right">
            <img src="http://www.webtify.be/elkegeraerts/img/elke_geraerts.png" alt="" width="200" />
        </div>
        <div class="clear"></div>
    </div>
</div>
<div class="home-bottom">
    <div class="container">
        <h1>home bottom</h1>
        <div class="img-left">
            <img src="http://www.webtify.be/elkegeraerts/img/boek.png" alt="" width="200" />
        </div>
        <div class="text-right">
            some text goes here.
        </div>
        <div class="clear"></div>
    </div>
</div>
<div class="footer">
    footer
</div>

Answer №1

Make sure the images have "display:block;" applied to them.

img{
    display:block;
}

https://jsfiddle.net/

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

As I continue to fill the child DIV element with more text, the shrink wrap is compromised and eventually breaks

Snippet of HTML code: <div id="container"> <div id="first"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean lacinia velit ut magna ultricies. </div> <div id="second"> Blandit </div ...

Tips for creating a responsive input field within a navbar

Can anyone assist me with setting the input field width in my navbar to adjust to the remaining width of the navbar and be responsive to different device sizes? I need the input field to dynamically change its width based on the screen size. Any help would ...

Cross-origin resource sharing (CORS) issue encountered while trying to play an mp

I am facing an issue with my React application where it is unable to play audio from a different source due to a CORS error. Example: Interestingly, when I visit https://www.w3schools.com/tags/tag_audio.asp, input the above URL and click play, it works fi ...

No translation or compiling of SCSS/SASS to CSS available

As a beginner Sass user, I am working on mastering the SMACSS hierarchy and incorporating it into my project using Brackets. However, I have encountered an issue with mapping the main.scss file to the main.css file even though it compiles successfully via ...

Using jquery to update the overall quantity of likes

Utilizing jquery, html, and php, I have successfully implemented a like button on my page. However, I am currently facing an issue with displaying the total number of likes without refreshing the page. Upon clicking the like button, the jquery and php scr ...

I am having trouble with my scroll reveal effects on JavaScript, how can I troubleshoot and fix the issue?

I'm currently making updates to my portfolio website, but for some reason, the scroll reveal animation has suddenly stopped working. I made a few edits and now it seems to be broken. /*===== SCROLL REVEAL ANIMATION =====*/ const sr = ScrollReveal({ ...

The image appears smaller than its actual size

I'm having an issue with an image control that is supposed to display a logo on my webpage. The image itself is 500 x 500 pixels, however, when it appears on the screen, the control automatically shrinks it down to 19x20. I've been struggling to ...

What are the steps to creating a webpage with scrolling in HTML?

Essentially, I have a question that may sound similar to others, but please hear me out. What I am looking for is the ability to have one photo fixed in place while being able to scroll within it. To provide a better understanding, here is an example: www. ...

Tracking time while watching HTML5 videos

I am facing a challenge with an HTML5 Video on my website. I would like to track the progress of the video and trigger a function or alert when it reaches specific time intervals, such as 10 seconds, 20 seconds, 30 seconds, and so on. I have tried using jQ ...

Is JavaScript asynchronous when it comes to manipulating the DOM?

While conducting Javascript tests on the Android browser, I monitored the number of instruction counts executed on the CPU. The test code for JS is straightforward and embedded within HTML files located in the local directory of an Android device, not on a ...

My JavaScript code is being executed before Chrome Auto-fill

I have successfully created form input elements in Chrome that display a floating label when focused. However, I am encountering an issue when the browser autofills the username and password fields with yellow prefilled text. The JavaScript for the float ...

What could be causing my JavaScript code to malfunction, even though it appears to be coded correctly?

// JavaScript Document "use strict"; $(window).scroll(function(){ if($(window).scroll() > 100){ $("#scrollTop").fadeIn(); } }); $(window).scroll(function(){ if($(window).scroll() < 100){ $("#scrollTop").fadeOut(); } }); $(document).ready(function() ...

Two interactive dropdown menus featuring custom data attributes, each influencing the options available in the other

Looking to create interactive select boxes based on the data attribute values? This is the code I currently have: HTML <select id="hours" onchange="giveSelection()"> <option value="somethingA" data-option="1">optionA</option> <o ...

Troubles with aligning and floating three divs in the center of a container div – a CSS conundrum illustrated with code snippets and a basic diagram

I'm struggling to center 3 divs within a "container." Here's a rough idea of what I'm going for: ______________________ | ___ ___ ___ | | |___| |___| |___| | |______________________| The issue I'm facing is g ...

What is the best way to navigate a carousel containing images or divs using arrow keys while maintaining focus?

Recently, I have been exploring the Ant Carousel component which can be found at https://ant.design/components/carousel/. The Carousel is enclosed within a Modal and contains multiple child div elements. Initially, the arrow keys for navigation do not work ...

What is the process for triggering data-dismiss after the href has been activated?

Could someone help me with this issue? <a class='btn btn-danger' href='page.html'>Delete</a> I am trying to activate the "data-dismiss" attribute after the "href" is activated. My initial attempt was using this code: < ...

Creating an Email Template using Razor View Page

After creating an Email Template using Razor Syntax, I encountered an issue when sending it via C# code and SMTP protocol. The email body displayed the raw Razor and HTML markups instead of rendering properly. Could it be that Razor Pages are not suitable ...

Expand and Collapse Button for Customizing Table Height Individually

I trust everything is going smoothly. A challenge I'm facing involves implementing a button to expand a specific row within a table. Currently, clicking the "show more/show less" button extends all rows when the goal is to do it for each individual ta ...

Load a page from a different domain using uframe

Looking for a solution to successfully load an external URI using uFrame. Currently encountering an "Access Denied" issue when attempting to do so on Firefox. Any suggestions? ...

Unusual grey rectangle (similar to a selection tool) found in the top left corner of a contenteditable div on

I recently utilized Vue to create a contenteditable div on my website. However, I encountered an issue where a gray area appeared on the upper left corner when hovering over the div. Oddly enough, this problem only occurred in Chrome, while Safari and Fire ...