简体   繁体   English

CSS:用文本替换字体图标

[英]CSS: replace font icons with text

I have a header where buttons are displayed as font icons.我有一个标题,其中按钮显示为字体图标。 I want to replace them with simple text for each button.我想用每个按钮的简单文本替换它们。 Here's my code right now, how would I go about doing that?这是我现在的代码,我该怎么做? I hope I'm getting this right我希望我做对了

<li class="wp_dashboard_tab_content_header_%1$s">
    <a href="#tab_wp_dashboard_tab_content_header_%1$s"
      id="wp_dashboard_tab_content_header_%1$s" 
      class="wp_dashboard_icon_header_%1$s wp_dashboard_icon">
        <span></span>
    </a>
</li>

In my CSS file I have, for example例如,在我的 CSS 文件中

.wp_dashboard_icon_header_home:before {
  content: "\e653";
}

You need to add to the specific element font-family .您需要添加到特定元素font-family That's because by default, element who need to be render as font-icon has font-family which contains icon but no letters or numbers.这是因为默认情况下,需要渲染为 font-icon 的元素具有font-family ,其中包含图标但不包含字母或数字。

Try to set尝试设置

.wp_dashboard_icon_header_home:before {
   font-family:Arial;
   content: "Some text";
}

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

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