HTML和CSS,在不丢失表单动作的情况下水平对齐2个按钮

HTML和CSS,在不丢失表单动作的情况下水平对齐2个按钮

这两个按钮中的每个按钮都调用一个外部php页面。两者在页面上的显示方式都是垂直对齐的。如何在彼此之间水平 对齐,当然又保持水平。。查看截图

下面的代码,非常感谢。

<form action="reboot.php" method="get">
  <button class="button button3" type="submit">Server Reboot</button>
</form>

<form action="shutdown.php" method="get">
  <button class="button button3" type="submit">Server Shutdown</button>
</form>
windls 回答:HTML和CSS,在不丢失表单动作的情况下水平对齐2个按钮

您可以尝试在两个按钮上应用“显示:内联”。

<form action="reboot.php" method="get" class="inline">
  <button class="button button3" type="submit">Server Reboot</button>
</form>

<form action="shutdown.php" method="get" class="inline">
  <button class="button button3" type="submit">Server Shutdown</button>
</form>
.inline {
    display: inline;
}
,

这是您的方法!

<div class="form-wrapper">
<form action="reboot.php" method="get">
  <button class="button button3" type="submit">Server Reboot</button>
</form>

<form action="shutdown.php" method="get">
  <button class="button button3" type="submit">Server Shutdown</button>
</form>
</div>
.form-wrapper{
    display: flex;
}
CSS中的

display: flex将其所有包含项水平对齐。

本文链接:https://www.f2er.com/3128960.html

大家都在问