在表单中对齐三个按钮

菲利波·斯卡拉穆扎

我正在尝试将表单内的三个按钮对齐,但中央的按钮始终固定在底部。

jsfiddle 草图

---HTML---

<form action="view.php" method="GET">
    <button class="option delete-option" type="button"></button>
    <button class="btn" type="submit">59752fbd5f346</button>
    <button class="option edit-option" type="button"></button>
</form>

---CSS---

.btn {
    font-family: 'Arima Madurai', cursive;
    background-color: Transparent;
    color: black;
    cursor: pointer;
    font-size: 16px;
    max-width: 300px;
    position: relative;
    width: 100%;
    border: 1px solid;
    overflow: hidden;
}
.btn span {
    font-family: 'Arima Madurai', cursive;
}
.btn:after {
    background: red;
    content: "";
    height: 155px;
    left: -75px;
    opacity: .2;
    position: absolute;
    top: -50px;
    -webkit-transform: rotate(35deg);
    transform: rotate(35deg);
    -webkit-transition: all 2000ms cubic-bezier(0.19, 1, 0.22, 1);
    transition: all 2000ms cubic-bezier(0.19, 1, 0.22, 1);
    width: 50px;
    z-index: -10;
}

.btn:hover:after {
    left: 120%;
    -webkit-transition: all 2000ms cubic-bezier(0.19, 1, 0.22, 1);
    transition: all 2000ms cubic-bezier(0.19, 1, 0.22, 1);
}

.option{
    opacity: 0.5;
    transition: 200ms;
  width: 32px;
  height: 32px;
  border: 0;
  position: relative;
}

.option:hover{
  opacity: 1;
}

.delete-option{
  background: url("http://icons.iconarchive.com/icons/awicons/vista-artistic/32/delete-icon.png") no-repeat scroll 0 0 transparent;
}
.edit-option{
  background: url("http://icons.iconarchive.com/icons/custom-icon-design/mono-general-2/32/edit-icon.png") no-repeat scroll 0 0 transparent;
}

我还注意到从 Mozilla 打开页面时,中央按钮似乎固定在顶部。

杰拉德

您可以将表单设为 flexbox:

form {
  display: flex;
  justify-content: space-between;
  width: 70%; /* just for demo */
}

.delete-option {
  background: url(http://icons.iconarchive.com/icons/awicons/vista-artistic/32/delete-icon.png) no-repeat scroll 0 0 transparent;
}

.btn {
  font-family: 'Arima Madurai', cursive;
  background-color: Transparent;
  color: black;
  cursor: pointer;
  font-size: 16px;
  max-width: 300px;
  position: relative;
  width: 100%;
  border: 1px solid;
  overflow: hidden;
}

.edit-option {
  background: url(http://icons.iconarchive.com/icons/custom-icon-design/mono-general-2/32/edit-icon.png) no-repeat scroll 0 0 transparent;
}

.option {
  opacity: 0.5;
  transition: 200ms;
  width: 32px;
  height: 32px;
  border: 0;
  position: relative;
}
<form action="view.php" method="GET">
  <button class="option delete-option" type="button"></button>
  <button class="btn" type="submit">59752fbd5f346</button>
  <button class="option edit-option" type="button"></button>
</form>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

我应该如何对齐三个按钮,以便它们在Bootstrap中水平堆叠

在第三个表单中按提交按钮的同时提交第一个表单

在python中对齐三个时间序列

在容器内对齐三个元素(左/中/右)

在HTML / CSS中对齐三个对象

如何在Android中水平对齐三个ImageView?

按钮中的UIImage之后随机出现三个点

一个表单文档,一个提交按钮如何实现三个功能?

水平对齐三个 TextView 块

在flexbox的底部对齐三个div

如何将三个水平对齐的按钮与bootstrap 3均匀隔开?

通过一个提交按钮将三个表单一起提交

HTML表单,从三个单选集中仅选择一个单选按钮

在表单中的Access的三个子表单中显示基于相同ID的记录

每行三个缩进文本块中的第二个未对齐

如何创建一个只有三个提交按钮的带有三个文本输入字段的表单

如何在同一行中对齐图例标记中的三个元素?

表单中的右对齐按钮

为什么此网格中的第三个元素与页面底部对齐?

选择表单-在第三个表中链接两个表

如何使第二个活动中的按钮打开第三个活动?

三个按钮,三种不同的动作/输出

在用户表单中复制粘贴三个不同的范围

如何在 Rails 5 中为第三个嵌套模型编写表单代码?

在 Shiny 仪表板上对齐三个元素

想要水平对齐包含列表的三个div

从三个div列垂直对齐文本

三个文本正文与内联块不对齐

如何在 Xamarin 中创建顶部滚动视图和底部三个按钮?