r/csshelp • • 12h ago

Resolved Cannot seem to get rid of spacing to the left/right of a floated image

1 Upvotes

US Navy squadron VF-19/191

I am floating a couple of images, one to the left and the other to the right.

However, there are big spaces between the left and right margins of the respective images.

I have tried margins and padding values of zero and 1px, but the big gap is still there.

The relevant section of CSS is as follows:

/*----------------------------------*/
/* banner */
.banner {
clear: both;
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
border: double #ffd700;
background-color: #263042; /*dark blue */
}

.box_left {
float: left;
width: 20%;
margin: 10px;
clear: none;
}

.box_centre {
float: left;
margin: auto;
width: 40%;
clear: none;
}

.box_right {
float: right;
width: 20%;
margin-right: 1px;
padding-right: 0;
clear: none;
}

/*----------------------------------*/

The HTML is:

<div class="banner">

<img class="box_left" src="https://satans-kittens.neocities.org/images/VF-19.svg" width="149px" height="46px" alt="VF-19"/><!-- 149x46 -->

<img class="box_centre" src="https://satans-kittens.neocities.org/images/titleBar.svg" width="691px" height="69px" alt="Satan's Kittens" /><!-- 461x46 -->

<img class="box_right" src="https://satans-kittens.neocities.org/images/VF-191.svg" width="163px" height="46px" alt="VF-191" /><!-- 163x46 -->

</div><!-- close banner -->

Ignore the ".box_centre", that is work in progress...

I have searched places like W3Schools and so on, but cannot seem to close the gaps.

What am I missing/doing wrong?