gpt4 book ai didi

html - CSS 表输入

转载 作者:太空宇宙 更新时间:2023-11-04 10:44:39 25 4
gpt4 key购买 nike

我有两个按钮,我需要它们在我的表格中具有相同的宽度,但一个比另一个大。它们的宽度相同,但我想我改变了一些东西,但我无法将其恢复原状

body.products table {
table-layout: fixed;
}

body.products input.add[type="button"] {
color: white;
width: 100%;
background-color: #27af60;
border: none;
letter-spacing: .8px;
}

body.products input.del[type="button"] {
color: white;
width: 100%;
background-color: #c0392b;
border: none;
letter-spacing: .8px;
}

body.products input.submit[type="submit"] {
color: white;
width: 100%;
background-color: gray;
border: none;
letter-spacing: .8px;
}
<!DOCTYPE html>
<html>

<body class="products">
<form action="addtable.php" method="GET">
<table>
<tr>
<td colspan="2">
<input class="add" type="button" value="Add a Product">
</td>
<td colspan="2">
<input class="del" type="button" value="Delete a Product">
</td>
</tr>
<tr>
<td colspan="4">
<input class="submit" name="prod_submit" type="submit" value="Submit Products">
</td>
</tr>
</table>
</form>
</body>

</html>

最佳答案

除了 table-layout:fixed,您还必须添加宽度,例如 width:300px;

table{
table-layout: fixed;
width:300px;
}

input.add[type="button"]{

color:white;
width: 100%;
background-color: #27af60;
border: none;
letter-spacing: .8px;

}

input.del[type="button"]{

color:white;
width: 100%;
background-color: #c0392b;
border: none;
letter-spacing: .8px;
}

input.submit[type="submit"]{

color:white;
width: 100%;
background-color: gray;
border: none;
letter-spacing: .8px;
}
 <table>  
<tr>
<td colspan="2" ><input class="add" type="button" value="Add a Product"></td>
<td colspan="2" ><input class="del" type="button" value="Delete a Product"></td>
</tr>
<tr>
<td colspan="4"><input class="submit" name="prod_submit" type="submit" value="Submit Products"></td>
</tr>

</table>

关于html - CSS 表输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35527248/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com