将汉堡图标添加到bootstrap侧边栏

时间:2017-12-13 09:33:49

标签: javascript html css twitter-bootstrap sidebar


我正在尝试将汉堡菜单添加到我的侧边栏。 我正在使用bootstrap sidebar - 版本3.3.7,我的bootstrap.min.css复制到我的文件夹:

<link rel="stylesheet" type="text/css" href="/bower_components/bootstrap/dist/css/bootstrap.min.css"/> 


代码:

const contentHeader = (
    <span>
       <a href="#" onClick={this.menuButtonClick}>
         <span class="glyphicon glyphicon-menu-hamburger">=</span>
       </a>
       <span> My Site - {this.state.selected}</span>
  </span>);


当我运行网站时,我看不到图标,我试图调试网站 我发现这些元素是空的,当我编辑元素并添加class =&#34; glyphicon glyphicon-menu-hamburger&#34;时,汉堡图标出现了。
image of the debug of the element

如何让Icon始终出现?

1 个答案:

答案 0 :(得分:0)

我猜你从该语法中使用JSX + React,在这种情况下你需要在html属性中使用className而不是class。

我建议使用Atom编辑器,它应该为您突出显示该问题。

相关问题