html - 左边是文字,右边是图标 - Bootstrap

标签 html css twitter-bootstrap

如何使用 Bootstrap 将图标放置在最右侧并使文本保持在左侧。

这是我到目前为止的努力:https://www.bootply.com/5E2CGFEWdx

<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<div class="container">
  <div class="row">
    <button class="btn btn-lg btn-success col-xs-12"> Call Us <span class="glyphicon glyphicon-earphone push-right"></span></button>
  </div>
</div>

最佳答案

您可以使用 float: right 使您的图片靠右,并设置 text-align: left 这样文本将从左端开始。

Example here

align-left {
  text-align: left;
}

.push-right {
  float: right;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />

<div class="container">
  <div class="row">
    <button class="btn btn-lg btn-success col-xs-12 align-left"> Call Us <span class="glyphicon glyphicon-earphone push-right"></span></button>
  </div>
</div>

关于html - 左边是文字,右边是图标 - Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53719481/

相关文章:

HTML/CSS 显示=表格行对齐

css - 具有等于​​容器的 div 宽度

html - Bootstrap 4 - 4 个按钮(2 x 行)在同一按钮组响应

html - 将电影添加到组织模式 html 输出

javascript - PhoneGap/ Cordova : cannot prevent scrolling

javascript - 需要在屏幕调整大小时更改 div 输出和 javascript

javascript - 按钮出现时自动点击 - Chrome/Tampermonkey

html - 如何将 Bootstrap 的 clearfix 应用到我的代码中?

html Canvas : clipping and text

html - 是否可以使用 foundation 4 或 bootstrap 向 CSS 添加条件属性?