Skip to content
Related Articles

Related Articles

How to align an image and text vertically on the same line in React Bootstrap?

Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 14 Jan, 2021
Improve Article
Save Article

ReactJS has a very beautiful way to align images and text vertically in the same line in React Bootstrap. ReactJS is a front-end library developed by Facebook to build various components of the front-end. Bootstrap is a CSS framework developed by Twitter for building CSS enriched front end websites. 

Including Bootstrap: Bootstrap can be embedded in the React application by including the following link in the <head> section of our HTML page:

<link rel="stylesheet" 
      crossorigin="anonymous" />

The above code will embed the CSS Bootstrap framework into our HTML webpage.

Creating React Application:

Step 1: Create a React application using the following command:

npx create-react-app foldername

Step 2: After creating your project folder i.e. foldername, move to it using the following command:

cd foldername

Project Structure: It will look like the following.

Project Structure

We can align an image and text vertically by placing a break line tag in between an image and text tags. React HTML tags are self-closing tags, so make sure that as you open a tag, you close the tag also.

Filename: App.js


import React from "react";
import Container from "react-bootstrap/Container";
import Card from "react-bootstrap/Card";
import "./App.css";
const App = () => {
  const subtitle = "Hi There";
  return (
    <Container className="p-3">
              width: 20,
              backgroundColor: "red",
              verticalAlign: "center"
          <br />
          <i className="text-muted p-0" style={{ backgroundColor: "red" }}>
export default App;

Step to Run Application: Run the application using the following command from the root directory of the project:

npm start


Output of React example


My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!