我已经在我的h3标签中添加了3个glpyhs并且已经应用了一个样式但是我添加的每个字形它们似乎都向上移动所以它们彼此不一致(check link for picture)
这就是我在面板中添加字形的方法。
<div class="col-md-4 column">
<div class="panel panel-default" draggable="true">
<div class="panel-heading panel-backcolour">
<h3 class="panel-title">Panel title<span class="glyphicon glyphicon-trash panel-icons" /><span class="glyphicon glyphicon-trash panel-icons" />
<span class="glyphicon glyphicon-trash panel-icons" /></h3>
</div>
<div class="panel-body">
Panel content
</div>
</div>
</div>
这是我应用于面板的自定义css。
.panel-icons{
float: right;
cursor:pointer;
}
答案 0 :(得分:4)
您错过了关闭span
代码的信息。
另外我应该指出,span不是self closing标记,因为您已尝试使用它。
.panel-icons {
float: right;
cursor: pointer;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<div class="col-md-4 column">
<div class="panel panel-default" draggable="true">
<div class="panel-heading panel-backcolour">
<h3 class="panel-title">Panel title
<span class="glyphicon glyphicon-trash panel-icons"></span>
<span class="glyphicon glyphicon-trash panel-icons"></span>
<span class="glyphicon glyphicon-trash panel-icons"></span>
</h3>
</div>
<div class="panel-body">
Panel content
</div>
</div>
</div>
答案 1 :(得分:2)
更正您的标记,使span
正确关闭,如下所示:
<span class="glyphicon glyphicon-trash panel-icons"></span>
<span class="glyphicon glyphicon-trash panel-icons"></span>
<span class="glyphicon glyphicon-trash panel-icons"></span>
正如您的代码现在一样,它认为每个glyphicon都在上一个glyphicon中,并且您没有正确关闭span
标记。
有关工作示例,请参阅此codepen链接。