What is the best way to ensure these SVG images line up next to each other without disappearing?

I'm currently working with some code that utilizes Bootstrap 4, and it looks something like this:

<header>
  <div class="row">
    <div class="col-xs-12 col-md-9">
     <h1>Single and Satisfied</h1>
  </div>
  <div class="col-xs-12 col-md-3">
     <div class="col-xs-4">
       <img src="https://svgshare.com/i/Kmq.svg">
     </div>
     <div class="col-xs-4">
       <img src="https://svgshare.com/i/Kmq.svg">
     </div>
     <div class="col-xs-4">
       <img src="https://svgshare.com/i/Kmq.svg">
     </div>
   </div>
  </div>
</header>

For a visual representation of what I am aiming for, you can view my CodePen here: https://codepen.io/davidshq/pen/VwvrRGg

The desired output should look like this:

Single and Satisfied  Image1   Image2   Image3

However, the actual result ends up looking more like this:

Single and Satisfied  Image1
                      Image2
                      Image3

Attempts to use floats or d-flex to display the images on the same line have resulted in them disappearing altogether.

My research suggests that the responsiveness of the SVGs is causing them to size themselves according to their parent container, which defaults to no size. To address this, I am considering defining a size for the parent container but am unsure of the best way to do so within Bootstrap's guidelines.

If you have any suggestions or insights, they would be greatly appreciated!

Answer №1

If you want to tackle the issue of oversized SVGs, try this method:

To adjust the size of the svg to 100px each and fulfill your need, using flex will do the trick.

.row,.align{
  display:flex; 
}
<header>
  <div class="row">
    <div class="col-xs-12 col-md-9">
     <h1>Single and Satisfied</h1>
  </div>
  <div class="col-xs-12 col-md-3 align">
     <div class="col-xs-4">
       <img src="https://svgshare.com/i/Kmq.svg" style="height:100px;width:100px;">
     </div>
     <div class="col-xs-4">
       <img src="https://svgshare.com/i/Kmq.svg" style="height:100px;width:100px;">
     </div>
     <div class="col-xs-4">
       <img src="https://svgshare.com/i/Kmq.svg" style="height:100px;width:100px;">
     </div>
   </div>
  </div>
</header>

Answer №2

It seems that there is no col-xs-4 according to the information provided in the documentation at https://getbootstrap.com/docs/4.4/layout/grid/#grid-options. Perhaps you meant to use col-4.

If your goal is to arrange three images in a row, you should wrap them with a .row:

<div class="row">
  <div class="col-4">
    <img src="https://svgshare.com/i/Kmq.svg" />
  </div>
  <div class="col-4">
    <img src="https://svgshare.com/i/Kmq.svg" />
  </div>
  <div class="col-4">
    <img src="https://svgshare.com/i/Kmq.svg" />
  </div>
</div>

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

Issue with modal not being able to close the embedded video iframe

I have created a demo of a video in my footer that uses external CSS files and works perfectly. However, when I added it to the project, everything works except for closing the video. After clicking the play button in the footer, a modal appears on the sc ...

Prevent strange appearances when using slideDown animation

In my application, I am experiencing an undesirable side effect when using slideDown(). Upon clicking the element, a piece of content is appended to an ancestor. This causes the clicked button to shift to the right and the ones on the left to move slightly ...

Missing Calendar icon in Vue-Bootstrap's b-form-datepicker component

Is there a way to remove the calendar icon for the b-form-datepicker in Vue? https://i.sstatic.net/5uIj5.png I attempted to use styling with .bi-calendar { visibility: hidden; } However, this approach only works if the style is not scoped, but I spe ...

My webpage layout doesn't quite accommodate my content, so I need to adjust it to be more zoom

Why does the page container load bigger than the html/body container in mobile mode, as shown in the photo? https://i.sstatic.net/fD1N4.png Here is my CSS: html { margin-top: 48px; width: 100%; } body { margin: 0; width: 100%; background: ...

Guide to setting up Bootstrap in your Angular application

Currently attempting to incorporate bootstrap into my angular project. Here is the command I am inputting: npm install bootstrap jquery --save The response I receive is as follows: up to date, audited 1013 packages in 3s 92 packages are seeking fundin ...

How can I adjust the alignment of the text in a select menu in jQuery Mobile?

Exploring the world of jquery for the first time, I am excited about building a mobile web application. Utilizing jquery mobile (1.4.5), I encountered a simple issue - I couldn't figure out how to change the location of the text in the select menu. De ...

Difficulty encountered while implementing a carousel using HTML, CSS, and JavaScript

I'm currently working on creating a carousel using only HTML, CSS, and JS. While it is functional, it does not perform as smoothly as I had anticipated. After completing one full round of images, there is an approximate 8-second delay before it star ...

Making <div> elements responsive by rearranging their display order using CSS in media queries, troubleshooting issues with floats, and adjusting font sizes

I'm currently working on a webpage located at: On this page, there is a containing division with 5 elements inside. They are floated left in order to align vertically, but I am facing some challenges when it comes to adjusting my CSS for media querie ...

Removing the tick mark from a simulated checkbox

I'm looking for guidance on updating this code to manage unchecking an emulated checkbox. Let's start with the original input HTML: <input type="radio" name="rf538" id="rf538" class="page_checkbox"> Next, here is the CSS for the class pa ...

Using a CSS style to modify a class based on another class at the same level in the hierarchy

I am working with a jQuery carousel that is adding an 'active' class to images within a div. Within the same div, there is also a span with a 'fade' class that has a CSS style of opacity: 0. Is there a way to change the CSS style of the ...

Troubleshooting: Bootstrap interfering with external CSS file and causing errors

Attempting to utilize Bootstrap for the design of my website, I encountered an issue when trying to implement an external CSS file named "mycss.css". Unfortunately, it seems to not be functioning properly at all. Both the file, "mycss.css" and index.php ar ...

Ways to replace CSS classes created using makeStyles

To clarify, my development environment is using MUI version 4.12.3. Inside file A, I have a simplified code snippet for a functional component, along with the usage of makeStyles to style a JSX element within the return statement (not displayed here). Ever ...

Tips on expanding the background beyond the boundaries of a parent container with a specific width limit

Could you please take a look at the code snippet below? I am dealing with a situation where I have a container with a fixed width, and inside that container, there are rows whose width exceeds that of the parent container. Some of these rows have a backgro ...

Having trouble with the carousel functionality

I am facing an issue with the images displayed inside a Bootstrap carousel: `$.getJSON("http://127.0.0.1/CM/public/calendar/getimg/"+data.id, function(data) { var div = $("<div id='carousel-example-captio ...

CSS hack for Safari that can also be used on IE8

Supporting browsers like Mozilla Firefox 14, IE8, Safari 5.1.1, and Chrome 19 on an HTML page can be quite a challenge. In order to maintain proper alignment of elements on the page, I have had to resort to using CSS hacks. Here is the CSS code: For Mozi ...

When scrolling, use the .scrollTop() function which includes a conditional statement that

As a newcomer to jQuery, I've been making progress but have hit a roadblock with this code: $(window).scroll(function(){ var $header = $('#header'); var $st = $(this).scrollTop(); console.log($st); if ($st < 250) { ...

What could be the reason for the unexpected behavior of position sticky?

I am encountering an issue while trying to figure out why the container__item--special element behaves as a sticky element in this code snippet <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8> ...

Hover over elements in jQuery to smoothly transition them from one class to another

Is it possible to achieve this? For example: .class1{ background-image:(whatever.jpg) color: #fff; } .class2{ background-image:(whatever2.jpg) color: #999; } Can I create a fade effect for all elements with class1 to class2 when the mouse hover ...

"HTML email design quandary: tackling a two-column layout

My attempts to create a two-column layout for a newsletter are leading to vertical alignment issues. Interestingly, some versions of Outlook display it correctly while others do not. Can anyone guide me on how to resolve this inconsistency? https://i.ssta ...

Issues with Laravel 5.8 and Bootstrap not functioning properly in Jquery

Check out this link for using Bootstrap Select. The code works perfectly in the view, but when I try to implement it with jQuery below, it doesn't work. Can someone help me fix this issue? View Code: <table id="tableAppointment" style=&q ...