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-4 col-sm-6 col-xs-12">
<div class="user-item">
<img src="https://bootdey.com/img/Content/avatar/avatar7.png" class="img-circle img-responsive img-user" alt=""/>
<div>
<strong>Alexandra Human </strong>
<small>Web Developer</small>
<p>
Curabitur nec nisl odio. Mauris vehicula at nunc id posuere.
</p>
</div>
</div>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="user-item">
<img src="https://bootdey.com/img/Content/avatar/avatar6.png" class="img-circle img-responsive img-user" alt=""/>
<div>
<strong>Martin Caricature </strong>
<small>Web Developer</small>
<p>
Curabitur nec nisl odio. Mauris vehicula at nunc id posuere.
</p>
</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:#ddd;
}
.user-item {
font-family: Verdana;
position: relative;
width: 100%;
cursor: pointer;
}
.user-item > img {
width: 100%;
}
.user-item > div small {
display: block;
color: #fff;
padding-top: 10px;
}
.user-item > div p {
color: #fff;
padding-top: 10px;
line-height: 16px;
font-size: 12px;
}
.user-item > div {
background: #5bc0de;
bottom: -50px;
line-height: 16px;
padding: 15px 0;
position: absolute;
text-align: center;
width: 100%;
-webkit-transition: all 0.3s ease 0s;
-moz-transition: all 0.3s ease 0s;
-ms-transition: all 0.3s ease 0s;
-o-transition: all 0.3s ease 0s;
transition: all 0.3s ease 0s;
padding: 20px;
}
.user-item:hover > div {
background: #5cb85c;
bottom: -75px;
color: #000000;
}
.img-user {
padding: 4px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
}