简体   繁体   English

使用position属性使用图标

[英]Using the position property use the icon

I am totally new to the web development. 我是Web开发的新手。 Here I have this icon: 这里有这个图标:

图像图标

I am using Font Awesome, and there is no icon that matches that, so I am trying to make a icon using the following way: 我正在使用Font Awesome,并且没有与之匹配的图标,因此我尝试使用以下方式制作图标:

<td>
   <div style={positionOf}>
      <i class="fa fa-envelope"></i>
      <i class="fa fa-check-circle" aria-hidden="true"></i>
   </div>
</td>
{
   top: 0.3em;
   position: absolute;
}

Here I am trying position : absolute to the second icon and relative to the first one. 我在这里尝试的position : absolute第二个图标,相对于第一个图标。

So, but this is not working. 因此,但这不起作用。 Can any one help me with this ? 谁能帮我这个 ?

Thanks. 谢谢。

To make sure your code is working you have to give some values to the icons. 为了确保您的代码正常工作,您必须为图标提供一些值。 By giving some values to the icon they will be indented. 通过为图标提供一些值,它们将缩进。 Use the following Properties. 使用以下属性。

top : 14px;
left : 15px;

You can do this consider the classes that Font Awesome provides ( https://fontawesome.com/how-to-use/on-the-web/styling/ ) 您可以考虑使用Font Awesome提供的类( https://fontawesome.com/how-to-use/on-the-web/styling/

 .fa-check-circle, .fa-envelope { color: green; } .fa-circle { color: #fff; } 
 <script data-search-pseudo-elements src="https://use.fontawesome.com/releases/v5.8.1/js/all.js"></script> <span> <i class="fa fa-envelope" data-fa-transform="grow-15"></i> <span class="fa-stack "> <i class="fas fa-circle fa-stack-1x" data-fa-transform="left-20 down-18"></i> <i class="far fa-check-circle fa-stack-1x" data-fa-transform="left-20 down-18"></i> </span> </span> 

Try with 试试看

<div>
    <span class="icon-outer">
        <i class="fa fa-envelope"></i>
        <i class="fa fa-check-circle" aria-hidden="true"></i>
    </span>
</div>

.icon-outer{
  position:relative;
}
.fa-envelope{
  font-size:30px;
  color:green;
}
.fa-check-circle{
  position:absolute;
  right:5px;
  bottom:0px;
  color:#fff;
}

https://jsfiddle.net/lalji1051/wzvaqspr/7/ https://jsfiddle.net/lalji1051/wzvaqspr/7/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM