html - 带有按钮的 HTML 内联表单
问题描述
这是我的 HTML 代码:
<div class="text-right">
<form method="post" action="create_car_type.html">
<button type="submit" value=4 class="btn btn-danger ml-2 mr-3" title="Create a car type">
Create a type
</button>
</form>
<form method="post" action="delete_car_type.html">
<button type="submit" value=3 class="btn btn-warning ml-2 mr-3">
Delete a type
</button>
</form>
</div>
这两个按钮在表单内部,在 div 内部。它们在这个 div 中右对齐,但我想内联显示它们。它们当前的显示方式是一个位置高于另一个位置,这是我想要避免的。display: inline
我应该在某处包含类似的东西吗?这应该去哪里?
解决方案
添加样式=“显示:内联块;” 形成标签
<div class="text-right">
<form method="post" action="create_car_type.html" style="display: inline-block;">
<button type="submit" value=4 class="btn btn-danger ml-2 mr-3" title="Create a car type">
Create a type
</button>
</form>
<form method="post" action="delete_car_type.html" style="display: inline-block;">
<button type="submit" value=3 class="btn btn-warning ml-2 mr-3">
Delete a type
</button>
</form>
</div>
推荐阅读
- python - 如何指定打开哪一个
- javascript - 如何从提及 discord.js 添加角色
- azure - 限制 Azure DevOps Pipeline 中的并行作业数量
- python - 如何不通过大写其他代码来替换代码?
- typescript - Nestjs ScheduleModule(函数无权访问更新的类属性)
- docker - 在 Docker Compose 上运行 Postgres 迁移
- swift - 按钮状态恢复为不同的颜色
- finite-automata - 形式语言和自动机
- ios - 为什么我的自定义字体在 Xamarin.iOS 中不起作用?
- .net - 将数字显示为本地化单词 (.NET 5)