gpt4 book ai didi

html - 我想通过 bootstrap4 在不同的行中制作一个图标,文本

转载 作者:行者123 更新时间:2023-12-05 04:52:35 24 4
gpt4 key购买 nike

我想用bootstrap4制作一个图标,文本在不同的行。

伙计们,我正在通过 bootstrap4 练习初级水平;我在挣扎;我无法在第一行的中央制作图标,在第二行制作 h3 的副标题。

我用 h3 放置了文本,然后按类添加了一个图标,这影响了同一行中带有文本的图标。然而,这不是我想要的。

我又换了个方向,用grid创建了三个column,然后把icon一起放到div里面,效果更差.....h3的style和button text在第 3 行丢失了文本样式。

请告知解决方案,以便我完成挑战。

非常感谢!

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>

最佳答案

您可以将 text-center 类添加到您的 row 以使图标居中:

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

要修复列中的字幕,您需要将图标类移出列的样式。现在你有这样的东西:

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

...rest of the columns

h3 副标题的样式(实际上是整个列的样式)被 fas fa-icon 图标类覆盖。将图标放在 列中,这样可以解决该问题:

<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>

关于html - 我想通过 bootstrap4 在不同的行中制作一个图标,文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66448807/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com