Is it possible to align images vertically with text in a multi-column Bootstrap 4 container?

Inquiring on how to achieve vertical center alignment of text and images for a website section similar to the one shown in this image: https://i.sstatic.net/s8gNh.jpg. The intention is to align the logos and the corresponding text of company names situated on the left side of the image. The goal is to center the logos alongside their descriptive text.

HTML:

<div class="jarallax" data-jarallax-video="https://www.youtube.com/watch?v=v3Fie3AFMrA">
            <div class="overlay subSection container-fluid">
                <div class="row justify-content-center">
                    <div class="overlay-cell clearfix">
                    <div class="col-sm-12">
                        <h1 class="display-2 ">Research</h1>
                    </div>
                </div>
              </div>
            </div>
         </div>

         <section id="about">
             <h5 class="text-center pb-3">Discovering The Future.</h5>
             <div class="container">
                 <div class="row">
                     <div class="col-md-5">
                        <div class="row">
                            <div class="col-2">
                                <img src="assets/caolab.png" width="75" height="75"  alt="" class="img-fluid testphoto">
                            </div>
                            <div class="col d-flex align-items-center">
                                <h2>The Cao Lab</h2>
                                <h3>April 2016 – Present</h3>April 2016 – Present
                            </div>

                            <div class="col-md-5 offset-2">

                                </div> 
                        </div>
                     </div>
                 </div>
             </div>
         </section>
        

CSS:

.testphoto { 
          display: inline-block; 
          vertical-align:middle;
       }

        .labname{
          display: inline-block; 
          vertical-align:middle;
          border:solid black 1px; 
        }

        .shift{
            margin-left:20px;
        }

        .barbie{
          list-style: none;
            margin: 0;
            padding: 0;
        }

        .barbieitem{
          //text-align: right;
          font-size: 1.3em;
        }

        .joblist{
          display: inline-block;
        }

        .youtube {
          max-width: 300px;
          max-height: 300px;
          position: relative !important;
          float: right;

        }

        .teensie{
          top: 50%;
          left:50%;
          transform: translate(-50%,-50%);
        }

        .teensie2{
          position: relative;
          top: 50%;
          left:50%;
          transform: translate(-50%,-50%);
        }
        

Answer №1

Both the image and h2 element are nested in a row along with their corresponding columns. The image column has the class col-auto to maintain a narrow width, while the h2 column has the classes d-flex align-items-center to center the items vertically.

Check out the working code snippet below to see the layout in action:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<section id="about">
    <div class="container">
        <div class="row mt-4">
            <div class="col-md-11">
                <h3 class="font-weight-bold text-right">Discovering The Future.</h3>
            </div>
        </div>
        <div class="row">
            <div class="col-md-9">
               <div class="row">
                   <div class="col-auto">
                       <img src="https://picsum.photos/140/65" alt="" class="img-fluid testphoto">
                   </div>
                   <div class="col pt-3">
                       <h2>The Cao Lab</h2>
                       <h3 class="font-weight-bold pt-1 pb-3">April 2016 - Present</h3>
                       <ul>
                           <li class="pb-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit, consectetur adipisicing elit.</li>
                           <li class="pb-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit, consectetur adipisicing elit.</li>
                           <li class="pb-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit, consectetur adipisicing elit.</li>
                           <li class="pb-5">Lorem ipsum dolor sit amet, consectetur adipisicing elit, consectetur adipisicing elit.</li>
                       </ul>
                   </div>
               </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-9">
                <div class="row">
                    <div class="col-auto">
                        <img src="https://picsum.photos/140/65" alt="" class="img-fluid testphoto">
                    </div>
                    <div class="col pt-3">
                        <h2>Institut Parisien</h2>
                        <p class="text-primary">National Blue text lorem ipsum dolor sit amet consectetur adipisicing elit.</p>
                        <h3 class="font-weight-bold pb-3">May 2017 - August 2017</h3>
                        <ul>
                            <li class="pb-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit, consectetur adipisicing elit.</li>
                            <li class="pb-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit, consectetur adipisicing elit.</li>
                            <li class="pb-3">Lorem ipsum dolor sit amet, consectetur adipisicing elit, consectetur adipisicing elit.</li>
                            <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit, consectetur adipisicing elit.</li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>

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

Replace the bullet icon with a double quote symbol

My HTML List needs a different look - I want to change the bullet icon into a double quote icon. A website that I found interesting is this one. Here's the CSS code I have: .listStyle li:before { list-style: none; content: "\00BB"; } < ...

The uploaded file does not display its name

My form includes a section for uploading images, but I'm facing an issue where the label for the uploaded image does not display the actual file name. I tried implementing a code snippet that partially solved the problem by displaying the image as "C: ...

Blazorise's Bootstrap Responsive Class Enhancements

How can you adjust the responsive layout options of a column using the ColumnSize property in Blazorise bootstrap grid components? Specifically, I am looking to make the column size 12 on small screens. <Row> <Column ColumnS ...

Is it possible in Javascript to trace the origins of a particular element's property inheritance for debugging purposes?

I'm currently dealing with an issue where the computed style font-size of a particular element is "16px". I've been attempting to pinpoint where in the CSS or JavaScript this font size setting is coming from, specifically within one of its parent ...

How to control the audio currentTime using Angular 2 component

Here is the HTML code snippet that creates an HTML5 audio element: <audio id ="audio2" controls="controls" autoplay="false" (canplay)="CanPlay($event)"> <source src="http://localhost:51657/Audio/1" type="audio/mp3"> </audio> In the ...

Troubleshooting: Issue with jQuery not retrieving the value of input:nth-child(n)

My goal is to dynamically change the price when the model number changes, requiring the id number and quantity to calculate it accurately. Here is the HTML code I have: <div class="col-sm-9 topnav"> <span> ...

When an image is added, it will display against a backdrop of pure white

Hey there, I have a question regarding an image on my website. I removed the background using PowerPoint, but when I upload it, there is still a white background around it. Even changing the background color doesn't remove the white outline. Any tips ...

Issue with Masonry layout not adjusting to change in window size

Something seems to be fixed on displaying four rows, no matter the size of the window. Previously, it would adjust to three rows or fewer as the browser was resized. I recently played around with columnWidth, but reverting it back to 250 doesn't seem ...

Tips for using jQuery to add or append a class to the final li element

I am currently struggling to understand why the last child of the li element is not being inserted into the last li. This module functions as a treeview, and my main objective is to add a class to the last li. Let me demonstrate with some sample code and ...

Having trouble importing Bootstrap into Next.js? It seems like the issue may be related to the

I am currently facing an issue with importing bootstrap 5.3.2 (not react-bootstrap) into my NextJS 14.1.0 project that utilizes the new App Router. My goal is to strategically utilize individual Bootstrap components (not through data-attrs). I managed to ...

Adding a dynamic form to each row in a table: A step-by-step guide

https://i.sstatic.net/HctnU.jpg Hey there! I'm facing a challenge with dynamically generated rows in a form. I want to send only the inputs from the selected row when a checkbox is clicked. Can you help me figure this out? I tried using let rowForm ...

Creating text input without borders using HTML and CSS

I have managed to create text inputs without borders using HTML and CSS, but I am facing an issue. Whenever I click on the input field, a yellow border appears instead of the one I removed. It seems like this is coming from the default stylesheets, and I&a ...

Is it possible to change the style of an element when I hover over one of its children?

Encountered an issue while working with HTML and CSS: //HTML <div> <div class="sibling-hover">hover over me</div> </div> <div class="parent"> <div>should disappear</div> </div> ...

What is causing the "draggable='true'" attribute to fail on a React-rendered component?

This situation is really frustrating me, and I am hoping that someone can offer some assistance. I'm working with a React.Component that looks like this: var Vehicle = React.createClass({ ondragend: function(e) { e.preventDefault(); ...

Different color for background of division

I am working with a structure that looks like this: <div class="wrapper"...> <a href="#"...>blah</a> <div class="post"...>stuff</div> </div> This structure repeats multiple times on a dynamic page. I am looking f ...

Technique for updating URL when submitting a form on a webpage

I'm a newcomer to the world of coding and I have a simple issue that needs fixing. I want to create a form field where users can input the last segment of a URL provided to them. After entering this segment, I want the page to refresh automatically a ...

Steps to display page content only after running Java code in JSP

The webpage index.jsp is responsible for retrieving images and text data from a database using Java code. Within the JavaScript file, I have included: $(document).ready(function(){ //When Document is Ready, Show the Main Page $("#showifjavaenable ...

Launch an Android application directly from a web browser upon the webpage's loading

When a user visits www.example.com/myApp, I want my app to open automatically without any click required. I have attempted the following methods: window.onload = function () { window.location.replace("intent://something#Intent;scheme=myapp;packag ...

Implementing customized line breaks in PHP using custom fields

My knowledge of PHP is quite limited, so I prefer to seek advice from experts before attempting anything I find online. I recently installed a customized billing field plugin in order to collect additional billing information during the checkout process. ...

I currently have some code for a toggle button and a collapse feature, but I'm struggling to integrate the two

I need assistance with implementing a toggle animation I found here: https://codepen.io/7harrypotterrr/pen/OrBwPY. I'm unsure how to apply it to my code and replace the current toggle button that is in use here: https://codepen.io/7harrypotterrr/pen/e ...