我已經創建了一個關於學生數據庫的struts2應用程序。 問題在於,無論何時在表中顯示數據庫之後添加提交按鈕,該按鈕都被與之前表格的行寬相似的大背景包圍。我想刪除該邊框。表後的按鈕自動添加爲一行。如何分離他們?
看,怎麼也繞置按鈕灰色的背景,我不希望出現這種情況。
下面是代碼片段: JSP:
<table>
<tr>
<th>RollNo:</th>
<th>Name:</th>
<th>DOB:</th>
<th>Gender:</th>
<th>Address:</th>
</tr>
<%
while(rs.next())
{
%>
<tr>
<td><%=rs.getInt(1) %></td>
<td><%=rs.getString(2) %></td>
<td><%=rs.getString(3) %></td>
<td><%=rs.getString(4) %></td>
<td><%=rs.getString(5) %></td>
</tr>
<%
}
%>
</table>
<%
rs.close();
stmt.close();
conn.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
</div>
<br><br>
<s:form action="home.jsp">
<s:submit class="button4" value="Home"></s:submit>
</s:form>
table.css文件:
table {
background-color: #dbdbdb;
width: 60%;
}
th,td {
color: #363b3f;
border-bottom: 1px solid #ddd;
}
tr:nth-child(even) {
background-color: #c8c8c8
}
tr:hover {
background-color: #c488d7;
}
button.css
.button4
{
background-color: #af4ccf; /* purple */
border: none;
color: black;
padding: 18px;
font-family: 'Amputa';
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 14px;
margin: 4px 2px;
border-radius: 30%;
-webkit-transition-duration: 0.4s; /*Safari*/
transition-duration: 0.4s;
cursor: pointer;
}
.button4:hover
{
background-color: #c986df; /* Light purple */
}
我試圖封裝表並在單獨的div中按鈕。 另外我試過了,把按鈕放在不同的表格中。但沒有任何工作。 我似乎無法確定可能出錯的確切位置。 如何以及如何讓背景邊框消失並居中對齊按鈕?
不夠代碼...顯示我們所有的HTML/CSS ... –
瞭解如何在瀏覽器中使用的開發工具。 –