实际上,我有一个表,表中的行数动态增加/减少。所以我想适本地放置我的提交按钮。请指教。 这就是我正在尝试的: 在我的 servlet 中,我试图包含它:
"input[type=button] {"+
"position:absolute;"+
"transition: .5s ease;"+
"top: 80%;"+
"left: 75%;"+
"font-size: 22px;"+
"font-weight: bold;"+
"font-family: ariel;"+
"background-color: #ffedca;"+
"}"+
但是如果我的表中有 2 或 3 行,这就可以正常工作。但是如果我有超过 3 行, 输出将是:
1 CPA1 Validating release
2 CPA2 Validating release
3 CPA3 Validating release cancel ok
4 CPA4 Validating release
在上面的输出中,取消和确定按钮仅在 3 行中。
最佳答案
我喜欢 Flex Box ,您也许可以在类似于
的结构中工作<body>
<div class="form">
<input>
...some input fields
</input>
<button>My Submit</button>
</div>
<body>
然后是你的CSS
.form{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
这将使您的 .form div 中的所有子元素在 .form 中垂直和水平居中,而无需指定填充或边距
关于java - 如何对齐取消按钮,使其与不同的表格大小同步?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54264492/