1. First, we need fresh reactjs setup, and for that, we need to run below commands into out terminal, and also we should have latest node version installed on our system:
npx create-react-app my-awesome-project
cd my-awesome-project
npm start
2. Now we need to run below commands into our project terminal to get bootstrap and related modules into our reactjs application:
npm install [email protected] --save
npm start //For start project again
3. Finally for the main output, we need to add below code into our my-awesome-project/src/App.js file or if you have fresh setup then you can replace my-awesome-project/src/App.js file code with below code:
import React from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
function App() {
return (
<div>
<div class="container">
<div class="row">
<div class="col-md-6 col-xl-4">
<div class="card borderless-card">
<div class="profile-card">
<img class="img-fluid" src="https://www.bootdey.com/image/350x280/FFB6C1/000000" alt=""/>
<div class="card-block">
<h3>Title</h3>
<p>Lorem ipsum dolor sit amet, consectetuer</p>
<button class="btn btn-info ">+ Follow</button>
</div>
</div>
<div class="card-footer bg-inverse">
<div class="row text-center">
<div class="col-sm-4">
<h4>134</h4>
<span>Shots</span>
</div>
<div class="col-sm-4">
<h4>13,227</h4>
<span>Shots</span>
</div>
<div class="col-sm-4">
<h4>488</h4>
<span>Shots</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-xl-4">
<div class="card borderless-card">
<div class="profile-card">
<img class="img-fluid" src="https://www.bootdey.com/image/350x280/87CEFA/000000" alt=""/>
<div class="card-block">
<h3>Title</h3>
<p>Lorem ipsum dolor sit amet, consectetuer</p>
<button class="btn btn-info ">+ Follow</button>
</div>
</div>
<div class="card-footer bg-inverse">
<div class="row text-center">
<div class="col-sm-4">
<h4>134</h4>
<span>Shots</span>
</div>
<div class="col-sm-4">
<h4>13,227</h4>
<span>Shots</span>
</div>
<div class="col-sm-4">
<h4>488</h4>
<span>Shots</span>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-xl-4">
<div class="card borderless-card">
<div class="profile-card">
<img class="img-fluid" src="https://www.bootdey.com/image/350x280/FF7F50/000000" alt=""/>
<div class="card-block">
<h3>Title</h3>
<p>Lorem ipsum dolor sit amet, consectetuer</p>
<button class="btn btn-info ">+ Follow</button>
</div>
</div>
<div class="card-footer bg-inverse">
<div class="row text-center">
<div class="col-sm-4">
<h4>134</h4>
<span>Shots</span>
</div>
<div class="col-sm-4">
<h4>13,227</h4>
<span>Shots</span>
</div>
<div class="col-sm-4">
<h4>488</h4>
<span>Shots</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
}
export default App;
4. Now we need to add below code into our my-awesome-project/src/App.css file :
body{
margin-top:20px;
background-color: #f3f3f3;
}
.card {
border-radius: 5px;
box-shadow: 0 1px 11px 0 rgba(0, 0, 0, 0.12);
border: none;
margin-bottom: 30px;
}
.profile-card {
position: relative;
}
.profile-card .card-block {
text-align: center;
color: #fff;
position: absolute;
bottom: 0;
text-align: center;
width: 100%;
background: linear-gradient(transparent, rgba(0,0,0,0.72));
}
.card-block {
padding: 1.25rem;
}
.card .card-block p {
line-height: 25px;
}
@media only screen and (min-width: 1400px){
p {
font-size: 14px;
}
}
p {
font-size: 13px;
}
.btn-info {
background-color: #62d1f3;
border-color: #62d1f3;
color: #fff;
cursor: pointer;
transition: all ease-in 0.3s;
}
.btn {
border-radius: 2px;
text-transform: capitalize;
font-size: 15px;
padding: 10px 19px;
cursor: pointer;
}
.card .card-footer {
background-color: #fff;
border-top: none;
}
.profile-card ~ .card-footer {
padding: 0;
}
.bg-inverse {
background-color: #1a1b1d !important;
color: #fff;
}