首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在jumbotron中将图标添加到标题项

在jumbotron中将图标添加到标题项
EN

Stack Overflow用户
提问于 2020-01-30 21:11:14
回答 1查看 119关注 0票数 0

我有一台巨型加速器:

创建方式:

代码语言:javascript
复制
<div class="col-sm-2">
      <div class="jumbotron jumbotron-fluid top-space">
        <div class="container">
            <h1 class="display-6">Initiatives</h1>

            <p class="lead">The other good stuff.</p>
            <ul>
                <li>
            <a href="">Start an Initiative &#187;</a></li>
                <li>
            <a href="">More Information &#187;</a></li>
            </ul>
        </div>
    </div>
    <div class="jumbotron jumbotron-fluid top-space">
        <div class="container">
            <h1 class="display-6">News</h1>
            <p class="lead">Our Search Tool. <br> Love at first, second, third, fourth, fifth, and sixth sight.</p>
            <a href="">Try it out &#187;</a>
        </div>
    </div>
</div>

我想要一个红色方块上的图标。如何将其添加到我的h1 display-6中并将其对齐?

EN

回答 1

Stack Overflow用户

发布于 2020-01-30 21:32:34

代码语言:javascript
复制
.col-sm-2 > div:first-child .display-6::after{
  content: "" ;
  width: 40px;
  height: 40px;
  background-color: red;
  display: block;
  margin-left: 20px;
}
.col-sm-2 > div:first-child .display-6{
 display: inline-flex;   
}
代码语言:javascript
复制
<div class="col-sm-2">
        <div class="jumbotron jumbotron-fluid top-space">
          <div class="container">
              <h1 class="display-6">Initiatives</h1>
  
              <p class="lead">The other good stuff.</p>
              <ul>
                  <li>
              <a href="">Start an Initiative &#187;</a></li>
                  <li>
              <a href="">More Information &#187;</a></li>
              </ul>
          </div>
      </div>
      <div class="jumbotron jumbotron-fluid top-space">
          <div class="container">
              <h1 class="display-6">News</h1>
              <p class="lead">Our Search Tool. <br> Love at first, second, third, fourth, fifth, and sixth sight.</p>
              <a href="">Try it out &#187;</a>
          </div>
      </div>
  </div>

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59986821

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档