I want to make an icon, text in the different row by bootstrap4

Viewed 174

I want to make an icon, text in the different row by bootstrap4.

Guys, I am practising by bootstrap4 for beginner level; I am struggling; I could not make the icon in the centre in the first row and the subtitle by h3 in the second row.

I put text with h3 then add an icon by class, which affected the icon with the text in the same row. However, this is not what I want.

Again, I changed the other way round, so I created three columns by the grid, and I put the icon into the div together, but the effect is even worse.....the style by h3 and the button text in the 3rd row has lost the text style.

Please advise the solution so that I could clear the challenge.

Thanks and highly appreciated!

this is where I want to edit and fix

I want the effect like below

  <html>

<head>
  <meta charset="utf-8">
  <title>TinDog</title>
  <!-- Google Font -->
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;400;700&family=Ubuntu:wght@300;400;700&display=swap" rel="stylesheet">

  <link rel="preconnect" href="https://fonts.gstatic.com">

  <!-- css stylesheet -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <link rel="stylesheet" href="css/styles.css">
  <!-- fontawesome -->
  <script src="https://kit.fontawesome.com/e2fafd992e.js" crossorigin="anonymous"></script>

  <!-- Bootstrap Script -->
  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<body>

  
  <section id="features">

    <div class="container">
      <div class="row">
        <div class="col fas fa-check-circle">
          <h3>Easy to use.</h3>
          <p>So easy to use, even your dog could do it.</p>
        </div>

        <div class="col fas fa-bullseye">
          <h3>Elite Clientele</h3>
          <p>We have all the dogs, the greatest dogs.</p>
        </div>
        <div class="fas fa-heart">
        <h3>Guaranteed to work.</h3>
          <p>Find the love of your dog's life or your money back.</p>
        </div>
      </div>
    </div>
    
    </body>

</html>

2 Answers

You can add the text-center class to your row to center the icons:

<div class="row text-center">
    ...
</div>

To fix the subtitles in the columns, you need to move the icon classes out of the columns' styles. Right now you have something like this:

<div class="col fas fa-icon">
    <h3>Subtitle</h3>
</div>

...rest of the columns

The h3 subtitle's styles (the whole column's styles, actually) are overwritten by the fas fa-icon icon class. Place the icon within the column instead, like so, to solve that problem:

<div class="col">
    <i class="fas fa-icon"></i>
    <h3>Subtitle</h3>
</div>

...rest of the columns

demo

<html>

<head>
    <meta charset="utf-8">
    <title>TinDog</title>
    <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;400;700&family=Ubuntu:wght@300;400;700&display=swap" rel="stylesheet">
    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <link rel="stylesheet" href="css/styles.css">
    <script src="https://kit.fontawesome.com/e2fafd992e.js" crossorigin="anonymous"></script>
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
</head>

<body>
    <section id="features">
        <div class="container">
            <div class="row text-center">
                <div class="col"><i class="fas fa-check-circle"></i>
                    <h3>Easy to use.</h3>
                    <p>So easy to use, even your dog could do it.</p>
                </div>
                <div class="col"><i class="fas fa-bullseye"></i>
                    <h3>Elite Clientele</h3>
                    <p>We have all the dogs, the greatest dogs.</p>
                </div>
                <div class="col"><i class="fas fa-heart"></i>
                    <h3>Guaranteed to work.</h3>
                    <p>Find the love of your dog's life or your money back.</p>
                </div>
            </div>
        </div>
    </section>
</body>

</html>

Hi I made it finally and I believe I solve this problem. Thanks all

<div class="row">
  <div class="features-box col-lg-4 col-md-3">
    <i class="icon fas fa-check-circle fa-4x"></i>
    <h3>Easy to use.</h3>
    <p class="sub-title">So easy to use, even your dog could do it.</p>
  </div>

  <div class="features-box col-lg-4 col-md-3">
    <i class="icon fas fa-bullseye fa-4x"></i>
    <h3>Elite Clientele</h3>
    <p class="sub-title">We have all the dogs, the greatest dogs.</p>
  </div>

  <div class="features-box col-lg-4 col-md-3">
    <i class="icon fas fa-heart fa-4x"></i>
    <h3>Guaranteed to work.</h3>
    <p class="sub-title">Find the love of your dog's life or your money back.</p>
  </div>
</div>
</div>

#title{background-color: #ff4c68;
color: #fff;
}

body {
  font-family: "Montserrat";
}

.container-fluid{
  padding: 3% 15%
}

h1{
font-weight: bold;
font-size: 3.5rem;
line-height: 1.5;
}

h2{
  font-family: "Montserrat";
  font-weight: bold;
  font-size: 3.5rem;
  line-height: 1.5;
}

h3{
  font-family: "Montserrat";
  font-weight: bold;
  font-size: 18px;
}

p{
  color: #8f8f8f;
}

/* navigation bar */

.navbar{
  padding: 0 0 4.5rem;
}

.nav-item{
  padding: 0 18px 0 18px;
}

.nav-link{
font-size: 1.2rem;
font-family: "Montserrat";
font-weight: 400;
}


.navbar-brand{
  font-family: "Ubuntu";
  font-size: 2.5rem;
  font-weight: bold;
}

/* download buttons */

.download-buttons{
  position: relative;
  margin: 5% 3% 5% 0;
   right: 40px;
}

/* title-image */
.title-image{
  width:60%;
  -ms-transform: rotate(25deg); /* IE 9 */
  -moz-transform:rotate(25deg);
  -webkit-transform:rotate (25deg);
  transform: rotate(25deg);
}

/* features-section */
#features{
  padding: 7% 15%;
}

.sub-title{
  font-size: 15px;
}

.features-box{
  text-align: center;
  padding: 5%;
}

.icon{
  color: #ef8172;
  margin-bottom: 1rem;
}

.icon:hover{
color: #ff4c68;
}
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title>TinDog</title>
  <!-- Google Font -->
  <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@100;400;700&family=Ubuntu:wght@300;400;700&display=swap" rel="stylesheet">

  <link rel="preconnect" href="https://fonts.gstatic.com">

  <!-- css stylesheet -->
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
  <link rel="stylesheet" href="css/styles.css">
  <!-- fontawesome -->
  <script src="https://kit.fontawesome.com/e2fafd992e.js" crossorigin="anonymous"></script>

  <!-- Bootstrap Script -->
  <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<body>

<!-- Features -->

  <section id="features">

    <div class="row">
      <div class="features-box col-lg-4 col-md-3">
        <i class="icon fas fa-check-circle fa-4x"></i>
        <h3>Easy to use.</h3>
        <p class="sub-title">So easy to use, even your dog could do it.</p>
      </div>

      <div class="features-box col-lg-4 col-md-3">
        <i class="icon fas fa-bullseye fa-4x"></i>
        <h3>Elite Clientele</h3>
        <p class="sub-title">We have all the dogs, the greatest dogs.</p>
      </div>

      <div class="features-box col-lg-4 col-md-3">
        <i class="icon fas fa-heart fa-4x"></i>
        <h3>Guaranteed to work.</h3>
        <p class="sub-title">Find the love of your dog's life or your money back.</p>
      </div>
    </div>
    </div>


  </section>


</body>

</html>

Related