What is causing the file to automatically insert white space whenever I insert an image?

Working on a Bootstrap 4 website with three images inside a .row div, I encountered an issue. To ensure all images have the same height, I created a custom class setting height: 20% and width: auto. Though the images display as desired, there is extra spacing added beneath each image, creating a large gap between the image section and the following one. Any tips on avoiding this gap? Here's a fiddle showcasing the problem https://jsfiddle.net/wxg51v5x/ (Comment out the images for comparison). Thank you!

EDIT: Included the code itself.

HTML:

<!DOCTYPE html>
<html>
  <head>
    <title>Illicit Mind Inc. - Programs</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, shrink-to-fit=no" />
    <link rel="stylesheet" href="./css/bootstrap.min.css" />
    <link rel="stylesheet" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" href="./css/styles.css" />
  </head>
  <body>

<!-- Navbar -->
...

<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/jquery-ui.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/scripts.js"></script>
  </body>
</html>

CSS:

@font-face {
  font-family: 'Futura Book';
  src: url('./fonts/futura-book-webfont.woff2') format('woff2'),
       url('./fonts/futura-book-webfont.woff') format('woff');
  font-style: normal;
}
@font-face {
  font-family: 'Futura Heavy';
  src: url('./fonts/futura-heavy-webfont.woff2') format('woff2'),
       url('./fonts/futura-heavy-webfont.woff') format('woff');
  font-style: bold;
}
* {font-family: 'Futura Book', Arial, sans-serif}
...

#programs {background-image: linear-gradient(to top, #4191B4 5%, white 100%)}
#formula {background-image: linear-gradient(to top, white 0%, #4191B4 95%)}

Answer №1

The issue stemmed from the program-logo class and the use of large images.

To resolve this, I applied the img-fluid class to the images and utilized the px-5 class for the third image. I also reorganized the layout by incorporating the container class instead of container-fluid, as well as arranging images into row-column pairs for easier management using Bootstrap 4 predefined classes only (without any custom css).

Additionally, I experimented with background color classes (bg-warning and bg-secondary) for visualization purposes and made adjustments where deemed unnecessary. Please feel free to modify further if needed.

I focused on addressing the upper section and spacing beneath, which was the primary concern you raised. However, consider making some tweaks for the lower section due to potential display issues on wider 4K screens caused by the container-fluid.

Below is the revised code:

Answer №2

The issue with the space you mentioned is resolved by modifying the CSS property .program-logo width:auto;. I made the necessary adjustments in the code snippet below to eliminate the excess space. Feel free to test it out.

<!DOCTYPE html>
<html>
  <head>
    <title>Illicit Mind Inc. - Programs</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, shrink-to-fit=no" />
    <link rel="stylesheet" href="./css/bootstrap.min.css" />
    <link rel="stylesheet" href="./css/font-awesome.min.css" />
    <link rel="stylesheet" href="./css/styles.css" />
  </head>
  <body>

<!-- Updated Navbar Code -->
<!-- New navbar code optimized for responsiveness and design -->
</body>
</html>

CSS:

@font-face {
  font-family: 'Futura Book';
  src: url('./fonts/futura-book-webfont.woff2') format('woff2'),
       url('./fonts/futura-book-webfont.woff') format('woff');
  font-style: normal;
}
/* Rest of the CSS remains unchanged */

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

Passing dynamically loaded parameters to a function during dropdown value selection in Angular 2

Could you please review if I am passing the parameters correctly in the li tag's click function of the updateId method? The console errors only point to that line. This is my app.component.html code: <div class='form-group' style="width ...

Creating a professional HTML/CSS signature for optimal performance in Outlook 2016

For my email signature, I currently have an HTML coded design that includes a 400x415 dashed line with specific color specifications. However, Outlook Express 2016 is unable to display this element properly. Despite using inline CSS, it appears that CSS d ...

Encountering a TypeError with DataTables and Tabledit

I've been attempting to integrate DataTables with Tabledit, but I keep encountering the error message "TypeError: Cannot set properties of undefined (setting 'nTf')". The number of tags also matches up. Interestingly, if I comment out the " ...

Tips for managing table scroll in a flexbox design

Check out the demo here I am working with a table that has an indefinite number of rows and columns. When the table has a small number of rows and columns, it adjusts its width according to the available page space minus the width of the sidebar. Everythi ...

Retrieve the contents of the browser's DOM from within an Android operating system runtime

Imagine a typical login page similar to the one depicted below: https://i.stack.imgur.com/SF1Bd.jpg To interact with the HTML elements within the DOM, we can utilize either jQuery or conventional JavaScript like so: https://i.stack.imgur.com/e5aQZ.png ...

How to Manage Empty Lines in HTML Documents within WordPress

Just recently, I launched my brand new website. Everything seems to be functioning properly except for one issue that I discovered in the HTML source code. There are 15 blank lines before "<!doctype html>", which is causing some problems with SEO and ...

Challenge encountered with AJAX request

Whenever I trigger an AJAX request to a JSP using a dropdown menu, it works perfectly fine. However, when I try to trigger the same request using a submit button, the content vanishes and the page refreshes. function najax() { $.ajax({ url:"te ...

Ways to detect when the user begins typing?

There is an input box with a cross icon that clears the input when clicked. The icon is visible even when the box is empty, which may not make sense. It would be better to show the icon only when the user starts typing. How can I detect when the user start ...

Tips for updating the content of a div and navigating within a tab in one go

Embedded within a tab are several radio buttons and a div. By clicking on a button, I use Ajax to replace the div with specific content, which works perfectly. My ultimate goal is to navigate within the tab, meaning that, from within the div, I can click a ...

Moves are chosen to move downward when positioned next to an inline-block level element

Check out this jsfiddle example How can I prevent selects from moving down when there is an inline-block level element next to it? <select> <option value="" >Day</option> </select><select> <option value="" >Mon ...

"New to JQuery? Learn how to create interactive dialog boxes

Trying to incorporate the jqueryui dialog within my HTML page has been a challenge. Can anyone share any links to the necessary JavaScript libraries required to use the dialog widget? The HTML code I extracted from http://jqueryui.com/demos/dialog/modal- ...

I am looking to apply the Normal texture to the Fbx model, but I am encountering issues with the normal not functioning

This is an example. I am in need of a model with both a color map and a normal map. Just like the one seen in Microsoft 3D Viewer. https://i.sstatic.net/DU2vo.png Furthermore, I already have a model with a normal map. My approach involves using the re ...

Tips for preserving the dimensions of a container even after adding text dynamically

I have created a form and implemented a JavaScript warning for when the entered passwords do not match. However, I am facing an issue where adding the warning text causes other elements in the container to shift. Is there a way to prevent this from happe ...

Having trouble extending my navbar to the full height of the window

Having an issue with my code regarding the menu. I am trying to create a navbar that fills the height on the left side for PC screens and becomes scrollable at the top for mobile versions. The problem lies in my flex container not properly filling the scr ...

Scrolling horizontally using the WinJS list view

In my project, I incorporated a WinJS list view with the display style of ms-flexbox. However, I am facing an issue where the list is scrolling horizontally beyond its width even though I have set overflow to hidden. Is there a way for me to eliminate th ...

Container for Magazines using HTML and CSS

Looking to develop a digital magazine application with smooth swipe transitions and fade in effects when swiping left and right. I attempted using jQuery.mobile, but struggled with adapting the background image height. My goal is to create a universal web ...

Is it possible to toggle all parent targets in Bootstrap?

When trying to showcase my point, I believe it is best demonstrated by visiting Bootstrap documentation at https://getbootstrap.com/docs/4.0/components/collapse/ and viewing the "multiple targets section." In this section, you will find three buttons: togg ...

Produce an additional page while remaining on the present one

I have a PHP-based invoice system that displays all customer invoices. I am interested in adding a feature that allows users to print an invoice directly from the list page without navigating away. While I am familiar with window.print() and media="print" ...

Pass data from the view to the controller in CodeIgniter using an array

Take a look at: user_data received from the controller (Database middleware values) <?php $ID['IDS'] = array_column($user_data, 'ID'); print_r($ID); // print_r($ID)=Array( [IDS] => Array([0] => 0 [1] => ABC ...

Encountered an issue when attempting to select the password field in order to log into a Google account using

Having some trouble automating the login process for my Gmail account. Managed to find the email element with an ID, but hitting a roadblock trying to locate the Password element as it doesn't have an ID. Here's what I've attempted: passw ...