How to align an image and text vertically on the same line in React Bootstrap?
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" href= "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity= "sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" 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:
Project Structure: It will look like the following.
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.
Step to Run Application: Run the application using the following command from the root directory of the project: