css - 带有 css 的按钮上的文本对齐设计和图标

标签 css ionic-framework css-position

我需要它所说的帮助,我正在设计这些按钮,但它们看起来不像订单,我附上了图片。

enter image description here

好吧,我想要的是这样的(正如你在图片中看到的,一切都是有序的):

enter image description here

page-home {
    p {
        text-align: center;
        font-size: 15px;
        font-weight: bold;
        color: black;
    }
    .body {
        background-color: #FFEB3B;
    }
    .botones {
        vertical-align: text-bottom;
        border: none;
        color: white;
        text-align: left;
        text-decoration: none;
        display: inline-block;
        font-size: 17px;
    }
}

在 IONIC 中编写 HTML

<ion-content padding class="body" align="center">
    <img src="../../assets/logito.png" class="imagen">
    <br>
    <br>
    <button ion-button item-end round full icon-start class="botones">
        <ion-icon name='logo-facebook'></ion-icon>
        Registro via Facebook
      </button>
    <button ion-button item-end round full icon-start color="secondary" class="botones">
        <ion-icon name='person-add'></ion-icon>
        Servicio Particular
      </button>
    <button ion-button item-end round full icon-start color="dark" class="botones">
        <ion-icon name='briefcase'></ion-icon>
        Servicio Corporativo
      </button>
    <br>
    <p>¿Eres nuevo? <a href="http://ionicframework.com/docs/v2">REGISTRATE AHORA</a></p>
</ion-content>

最佳答案

这应该可以帮助您入门。

我为容器使用了一个 flexbox,并将内容居中。此外,按钮有额外的样式。

由于我不熟悉 ion,您可能需要重写 CSS 选择器。

p {
  text-align: center;
  font-size: 15px;
  font-weight: bold;
  color: black;
}

.body {
  background-color: #FFEB3B;
}

.botones {
  vertical-align: text-bottom;
  border: none;
  color: white;
  text-align: center;
  text-decoration: none;
  display: inline-block;
  font-size: 17px;
  width: 80%;
  height: 60px;
}

.botones:not(:last-child) {
  margin-bottom: 1em;
}

.botones[color="secondary"] {
  background: blue;
}

.botones[color="dark"] {
  background: red;
}

ion-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 400px;
}
<ion-content padding class="body" align="center">
  <img src="http://lorempixel.com/400/200/sports/" class="imagen">
  <br>
  <br>
  <button ion-button item-end round full icon-start class="botones">
        <ion-icon name='logo-facebook'></ion-icon>
        Registro via Facebook
      </button>
  <button ion-button item-end round full icon-start color="secondary" class="botones">
        <ion-icon name='person-add'></ion-icon>
        Servicio Particular
      </button>
  <button ion-button item-end round full icon-start color="dark" class="botones">
        <ion-icon name='briefcase'></ion-icon>
        Servicio Corporativo
      </button>
  <br>
  <p>¿Eres nuevo? <a href="http://ionicframework.com/docs/v2">REGISTRATE AHORA</a></p>
</ion-content>

关于css - 带有 css 的按钮上的文本对齐设计和图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45571090/

相关文章:

html - 禁止点击 koken(轨道主题)首页上的主幻灯片(div?)

css - 修复了具有全宽图像背景的垂直侧边栏

CSS 动画和定位问题

javascript - 如何使用 Bootstrap 创建类似响应式选项卡的导航栏?

html - 仅在移动设备上图像周围的空白 - wordpress

html - 另一个 div 和文本上的背景图像

android - 在 Ionic/Cordova 应用程序上仅显示数字键盘

cordova - Ionic --live-reload 不在设备上运行应用程序

ionic-framework - Ionic 3 Google map 在 Android + IOS 上不显示

html - 如何使用图像 :fixed, z-index 和滚动效果