html - 彼此相邻的位置按钮

标签 html css button

我想在彼此旁边显示我的“返回”和“确认”按钮。如您所见,我尝试执行 display:inline-block 但它没有用。我认为可能存在一些冲突代码,但我不确定它在哪里。这可能是一个愚蠢的问题,但请耐心等待。

这是我的代码:

.form__confirmation {
  padding: 0px 55px;
}

.form__confirmation2 {
  padding: 0px 55px;
}

button {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
  background-color: #011f4b;
  border: 1px solid #DADDE8;
  color: #fff;
  padding: 18px;
  border-radius: 5px;
  outline: none;
  -webkit-transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  left: 350px;
  margin-bottom: 20px;
  display: inline-block;
}

button:hover {
  background-color: #1293e1;
}

button:active {
  background-color: #1083c8;
}
<div class="form__confirmation" type="submit" name="submit">
  <button>Confirm Information</button>
</div>
<div class="form__confirmation2">
  <button>Back</button>
</div>

Here's what it looks like

最佳答案

.form__confirmation,.form__confirmation2 {
      display: inline-block;
		}
<div class="form__confirmation" type="submit" name="submit">
  <button>Confirm Information</button>
</div>
<div class="form__confirmation2">
  <button>Back</button>
</div>

您将它们放置在 div 元素中,默认情况下它们是 display:block。在同一个 div 中包含两个按钮或使用 div{display:inline-block}

关于html - 彼此相邻的位置按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46345743/

相关文章:

html - 居中的 <div> 并不完全居中,为什么?

android - 使按钮更容易点击

ios - 按钮应该在点击后改变图像,但(随机)也改变其他按钮的图像

html - 当包含图像的 DIV 类大小正确时,如何更正不成比例拉伸(stretch)的图像?

javascript - 使用 JS 更改 Wordpress 站点上的按钮

css - 导航栏在不同浏览器中呈现不同

button - LinkedIn 按钮间歇性出现

javascript - 表单输入的字符计数器 - 不计数

javascript - 谷歌浏览器中没有 www 子域的页面显示不同

html - 在列表导航菜单中缩放背景图像的大小