如何在css中将徽标添加到以下span标记中

时间:2017-07-24 04:14:32

标签: html css twitter-bootstrap

需要在以下范围标记中添加一些徽标图像

<div class="container">
        <div class="col-md-4">

         <p><span class="glyphicon glyphicon-home"><br></span><b>LARGEST WAREHOUSES</b></p>
         <h6>Transport provide best theme for lioeiusmod tempor dolor list</h6>

<p><span class="glyphicon glyphicon-pushpin"><br></span><b>GOOD TRACKING SUPPORTS</b></p>
         <h6>Transport provide best theme for lioeiusmod tempor dolor list</h6>
</div>
</div>

我需要在此引导程序默认字体图像附近添加徽标

<span class="glyphicon glyphicon-home">
<span class="glyphicon glyphicon-pushpin">

我需要外部css文件我还有图像文件夹

1 个答案:

答案 0 :(得分:1)

您可以使用伪元素::before::after

.logo {
  position: relative;
  display: inline-block;
  height: 20px;
  width: 20px;
}

.logo::after {
  content: "";
  height: 100%;
  width: 100%;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0%;
  margin: auto;
  background-image: url('http://imagespng.com/Data/DownloadLogo/Success-Transparent.png');
  background-position: center;
  background-size: contain;
}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

<div class="container">
  <div class="col-md-4">
    <p><span class="logo"><br></span><b>LARGEST WAREHOUSES</b></p>
    <h6>Transport provide best theme for lioeiusmod tempor dolor list</h6>

    <p><span class="logo"><br></span><b>GOOD TRACKING SUPPORTS</b></p>
    <h6>Transport provide best theme for lioeiusmod tempor dolor list</h6>
  </div>
</div>

相应的风格

Fiddle