Tips for aligning images and text in the center of a row using Bootstrap

I am struggling to center the image along with the text in my code. I attempted to use a container, but it did not have the desired effect.

Below is the image:

https://i.sstatic.net/fnaj4.png

  <section id="features">
    <!-- <div class="container-fluid"> -->

    <div class="row justify-content-center">
      <div class="col-md-4 col-sm-12 title-text">
        <img src="images/feature1.png" alt="feature1">
        <h3 class="features-title">Food Listing.</h3>
        <p class="features-prgrph">Quickly and easily post information about food you want to share.</p>
      </div>
      <div class="col-md-4 col-sm-12 title-text">
        <img src="images/feature2.png" alt="feature2">
        <h3 class="features-title">Matchmaking</h3>
        <p class="features-prgrph">Find people in your area looking for food.</p>
      </div>

      <div class="col-md-4 col-sm-12 title-text">
        <img src="images/feature3.png" alt="feature3">
        <h3 class="features-title">Request System.</h3>
        <p class="features-prgrph">Request food from other users with a few taps.</p>
      </div>
    </div>
    
    <!-- </div> -->
  </section>

Answer №1

Here is a suggestion,

Include text-center for each element like this,

<div class="col-md-4 col-sm-12 title-text text-center">

Code:

 <section id="features">
    <!-- <div class="container-fluid"> -->

    <div class="row justify-content-center"> 
      <div class="col-md-4 col-sm-12 title-text text-center">
        <img src="images/feature1.png" alt="feature1">
        <h3 class="features-title">Food Listing.</h3>
        <p class="features-prgrph">Quickly and easily post information about food you want to share.</p>
      </div>
      <div class="col-md-4 col-sm-12 title-text text-center">
        <img src="images/feature2.png" alt="feature2">
        <h3 class="features-title">Matchmaking</h3>
        <p class="features-prgrph">Find people in your area looking for food.</p>
      </div>

      <div class="col-md-4 col-sm-12 title-text text-center">
        <img src="images/feature3.png" alt="feature3">
        <h3 class="features-title">Request System.</h3>
        <p class="features-prgrph">Request food from other users with a few taps.</p>
      </div>
    </div>

    <!-- </div> -->
  </section>

Output:

https://i.sstatic.net/5LmUy.png

Answer №2

Insert the class text-center into the div that has the title-text class.

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

What is the reason that setting margin to 0 auto centers an element, while using margin 1 auto does not have the same effect?

When using margin: 0 auto;, it means that there is a margin size of 0 on the top and bottom of the element, with the available space being divided equally for the left and right margins. This behavior works as expected in the example below. In contrast, c ...

Enhancing map aesthetics with a personalized color scheme using Bootstrap version 5.2.3

I've been attempting to incorporate an additional color into my Bootstrap 5.2.3 project, but the bg-* or text-* classes are not being generated. I attempted to follow the solutions for Bootstrap 5.1 that I found on GitHub, such as: $starorange: #df71 ...

Opacity error with jQuery slider specifically affecting Google Chrome browser

My Magento site features a custom-built slider that is both responsive and has unique touch behavior. The desired behavior for the slider is as follows: A three-image slider where the middle image has an opacity of 1.0, while the other two images have an ...

Issue with Font-Awesome icons failing to display properly when using the BootstrapCDN

Trying to integrate Font-Awesome icon fonts using the BootstrapCDN link with what seems like the latest version: <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet"> The link has been added to the <hea ...

having difficulty implementing the blur effect in reactJS

Currently, I am working on developing a login page for my project. Below is the code snippet I have implemented for the functionality: import React, { useState, createRef } from "react"; import { Spinner } from "react-bootstrap"; import ...

What is the method for specifying the HTML file extension within Visual Studio?

I am having issues with my project recognizing the CSS and other files in the HTML files I have created, even though I have double-checked the extension paths. How can I resolve this problem? https://i.stack.imgur.com/85ooE.png https://i.stack.imgur.com/F ...

What are the steps to create a dynamic navigation bar in React without encountering hydration issues?

My goal is to dynamically show or hide links based on user authorization. Here's my initial approach: const Navbar = () => { const { canDo, ...} = useUser(); //A Zustand store return ( <> <div> <ul> ...

Place a button in relation to the top of its parent element

I am trying to display control buttons at the top of a table cell when hovering over an image within the cell. Here is the HTML structure I have: <table id="pridat_fotky"> <tbody> <tr> <td class=" ...

I am having trouble with the CSS Hover and Active styling on my website

Below is the code for my navigation bar: <ul> <li><a href="index.html">HOME</a></li> <li><a href="portfolio.html">PORTFOLIO</a></li> <li><a href="resources.html">RESOURCES</a ...

styled-components: the parent's styles take precedence over the child's styles

image export const LogOutButton = styled.button` display: inline-block; .... `; export default styled(ThemedApp)` .... button { .... display: flex; .... } `; Upon inspection, it is evident that the Logout button (with class gBuhXv) ...

Altering the dimensions of Bootstrap's default navbar for a more compact look

Currently, I am attempting to modify the size of Twitter Bootstrap's standard navbar to a smaller dimension. My goal is to have the Brand/logo on the left side, menu options in the center, and social media icons on the right side within the navbar. U ...

The outcome of the JQuery function did not meet the anticipated result

Here is the code I am using: $("p").css("background-color", "yellow"); alert( $("p").css("background-color")); The alert is showing undefined instead of the expected color value. I have tested this code on both Google Chrome and Firefox. Strangely, it w ...

Fully responsive header designed for optimal experience at any screen height

I am facing issues with the header and cannot seem to find a solution. My goal is to make the header span 100% of the window screen height. I need a responsive header that adjusts to 100% height, and when resizing for a smaller viewport, nothing should sho ...

Adjusting the heights of various divs as a percentage to fill the containing parent div

Is it possible for child divs to adjust their height automatically based on a percentage within a parent div with set max dimensions using CSS? HTML: <div id="parent"> <div id="top"></div> <div id="bottom"></div> < ...

Creating diamond-shaped columns and rows in HTML using the Bootstrap framework is a fun and creative way to

Recently, I tackled the challenge of building a website based on a specific design. Within this design, there was a div element that included an image link. Despite my efforts, I found myself at a loss on how to proceed with this task. Here is the snippet ...

Tips for customizing the event target appearance in Angular 2?

After following the steps outlined in this particular blog post (section 3, event binding), I successfully added an event listener to my component class. I can confirm that it responds when the mouse enters and exits. <p class="title" (mouseenter)="unf ...

Creating a seamless vertical marquee of several images that continuously scroll from bottom to top without interruption can be achieved by following these

Currently, I am seeking to design a mobile-friendly HTML page that features a border with multiple color images moving smoothly from bottom to top on both the right and left sides of the mobile screen. The transition should be seamless without any gaps o ...

Activate Bootstrap 5 dropdown exclusively when positioned above its parent element

I am facing an issue with a Bootstrap 5 dropdown menu placed within a div. When I click the icon, the dropdown appears but only those options that overlap the parent div can be hovered/clicked. In the provided screenshot, the 'Action' option fun ...

Ways to determine the position of elements when they are centered using `margin:auto`

Is there a more efficient way to determine the position of an element that is centered using CSS margin:auto? Take a look at this fiddle: https://jsfiddle.net/vaxobasilidze/jhyfgusn/1/ If you click on the element with the red border, it should alert you ...

Attempting to open and display the contents of a text file (.txt) within a modal dialog box upon clicking a button

I am attempting to develop a modal that will appear when the user clicks on a specific button. The goal is for this modal to showcase text retrieved from a separate file stored on the server. My aim is to show this text within a dialog box modal. So far, ...