2017-06-12 127 views
-1

我想添加一个按钮这样的:如何使添加按钮

enter image description here

我已经试过如下代码:

<ActionBar> 
 
    <ButtonGroup> 
 
    <Button type="action fa fa-plus"> Add New </Button> 
 
    </ButtonGroup> 
 
</ActionBar>

但结果看起来不像我想要的,就像在下面的图片中。任何想法如何解决这个问题?

enter image description here

我看到的是,在按钮上的文本是不同的,这并不重要。

+0

<按钮类型= “动作” 类= “btnstyleclasshere”>添加新 –

+0

字体真棒只给你背后的文字图像,但不是边界 – FieryCat

+0

我会建议你实际添加img到你的按钮 –

回答

1

我对示例代码做了一些小的修改。加载引导字体真棒

<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous"> 
 
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 
 

 
<ActionBar> 
 
    <ButtonGroup> 
 
    <Button class="btn btn-default" type="action fa fa-plus"><i class="fa fa-plus"></i> Add New </Button> 
 
    <Button class="btn btn-default" type="action"><i class="fa fa-search"></i> Search </Button> 
 
    </ButtonGroup> 
 
</ActionBar>

2

请检查以下内容。

button[type=action]:before { 
 
    font-family: fontAwesome; 
 
    content: "\f067"; 
 
    font-size: 0.8em; 
 
} 
 

 
button[type=action] { 
 
    background-color: white; 
 
    border: thin solid darkgray; 
 
    font-size: 0.8em; 
 
    border-radius: 3px; 
 
    padding: 5px; 
 
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" /> 
 
<ActionBar> 
 
    <ButtonGroup> 
 
    <Button type="action"> Add New </Button> 
 
    </ButtonGroup> 
 
</ActionBar>

0

添加的字体awesome.css,它将使奇迹为您服务。使用font-awesome检查下面的代码,并为您提供加号图标添加按钮。

button[type=action]:before { 
 
    font-family: fontAwesome; 
 
    content: "\f067"; 
 
} 
 

 
button[type=action] { 
 
    cursor: pointer; 
 
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" /> 
 
<ActionBar> 
 
    <ButtonGroup> 
 
    <Button type="action"> Add New </Button> 
 
    </ButtonGroup> 
 
</ActionBar>

0

button{ 
 
background-color:white; 
 
border-color:lightgrey; 
 
border-style:solid; 
 
border-width:1px; 
 
padding:5px; 
 
border-radius:3px; 
 
}
<ActionBar> 
 
    <ButtonGroup> 
 
    <Button type="action fa fa-plus"> &#10010; Add New </Button> 
 
    </ButtonGroup> 
 
</ActionBar>