[英]How to use custom icons instead of Fontawesome icons
In this code i have used Fontawesome icons for nav dropdown. 在这段代码中,我使用了Fontawesome图标进行导航下拉菜单。 Now i have to pass custom icons. 现在,我必须传递自定义图标。 can anyone suggest how to achive it? 有人可以建议如何实现吗?
.nav-link-type-one::after,
li.show .nav-link-type-one::after {
right: -7px;
color: #fff;
font-size: 17px;
top: 1px;
font-family: FontAwesome;
content: "\f0d7";
position: relative;
}
.nav-link-type-one::after,
li.show .nav-link-type-one::after {
content: "\f0d7";
}
li.show .nav-link-type-one::after {
content: "\f0d8";
color: #ec7f4a;
}
Here is a site where you can create your own custom icons. 您可以在这里创建自己的自定义图标。 You just need to upload your custom created icon SVG and convert that to the font files. 您只需要上传自定义创建的图标SVG并将其转换为字体文件。 You can download that converted files and you can use that in your project. 您可以下载转换后的文件,也可以在项目中使用它。
---- Steps to follow --- Click the untitled project in the top right and then click New Project. ----遵循的步骤---单击右上角的无标题项目,然后单击“新建项目”。 There you can see Import Icon button on the left top. 在那里,您可以在左上方看到“导入图标”按钮。 Import and convert the custom SVG icons that you have created into font files 将您创建的自定义SVG图标导入并转换为字体文件
Here I have demonstrated the use of an image as icons in your fiddle my code is at the bottom. 在这里,我已经在您的小提琴中演示了将图像用作图标的用法,我的代码在底部。
.nav-link-type-three::after
Hope the following fiddle will work for you JSFiddle Link here 希望下面的小提琴为您服务JSFiddle Link here
.nav-link-type-three {
padding-right: 1.5rem !important;
padding-left: 1.5rem !important;
color: white !important;
text-decoration: none;
position: relative;
display: flex;
align-items: center;
justify-content: flex-end;
margin-right: 1rem;
}
.nav-link-type-three:hover{
text-decoration: none;
}
.nav-link-type-three::after, li.show .nav-link-type-three::after{
position: absolute;
background:url("your image path goes here...") no-repeat;
width:16px;
height:16px;
content: "";
right:0
}
li.show .nav-link-type-three::after{
transform:rotate(180deg)
}
I find the cleanest and most lightweight solution is to use inline svg's. 我发现最干净,最轻巧的解决方案是使用嵌入式svg。
The process is simple. 这个过程很简单。
.Icon { width: 30px; height: 30px; position: relative; vertical-align: middle; fill: #113d63; transition: all ease-in-out .2s; } #Icon-Menu .Path2 { fill: #b00; }
<div style="height: 0; width: 0; position: absolute; visibility: hidden;"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <symbol id="Icon-Menu" viewBox="0 0 100 100"> <path class="Path1" d="M93.417,5.333H6.583c-1.654,0-3,1.346-3,3v13.334c0,1.654,1.346,3,3,3h86.833c1.654,0,3-1.346,3-3V8.333 C96.417,6.679,95.071,5.333,93.417,5.333z" /> <path class="Path2" d="M93.417,40.333H6.583c-1.654,0-3,1.346-3,3v13.334c0,1.654,1.346,3,3,3h86.833c1.654,0,3-1.346,3-3V43.333 C96.417,41.679,95.071,40.333,93.417,40.333z" /> <path class="Path1" d="M93.417,75.333H6.583c-1.654,0-3,1.346-3,3v13.334c0,1.654,1.346,3,3,3h86.833c1.654,0,3-1.346,3-3V78.333 C96.417,76.679,95.071,75.333,93.417,75.333z" /> </symbol> </svg> </div> <svg class="Icon"><use xlink:href="#Icon-Menu" /></svg>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.