[英]Image button not visible inside a table cell
我的html代碼是
<tr>
<td><input type="image" style="height:25px; width:25px;" src="plus.png"></td>
</tr>
正在創建該單元,但未顯示圖像。 但是,如果使用img
標簽,它將顯示出來,因此圖像的src沒有問題。
編輯:CSS鏈接可能是問題,但不能弄清楚什么:-
*{
font-family: Arial, sans;
margin: 0;
padding: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
h1 {
margin: 1em 0;
text-align: center;
}
#container {
margin: 0 auto;
width: 50%;
}
#container input {
height: 2.5em;
visibility: hidden;
}
#container label {
background: #f9f9f9;
border-radius: 1em 1em 0 0;
color: #888;
cursor: pointer;
display: block;
float: left;
font-size: 1em;
height: 2.5em;
line-height: 2.5em;
margin-right: .25em;
padding: 0 1.5em;
text-align: center;
}
#container input:hover + label {
background: #ddd;
color: #666;
}
#container input:checked + label {
background: #DBF3FD;
color: #444;
position: relative;
z-index: 6;
/*
-webkit-transition: .1s;
-moz-transition: .1s;
-o-transition: .1s;
-ms-transition: .1s;
*/
}
#content {
background: #DBF3FD;
border-radius: 0 .25em .25em .25em;
min-height: 18em;
position: relative;
width: 100%;
z-index: 5;
}
#content div {
opacity: 0;
padding: 1.5em;
position: absolute;
z-index: -100;
}
#content-1 p {
clear: both;
margin-bottom: 1em;
}
#content-1 p.last {
margin-bottom: 0;
}
#content-2 p {
float: left;
width: 48.5%;
}
#content-2 p.column-right {
margin-left: 3%;
}
#content-3 p {
float: left;
width: 48.5%;
}
#content-3 p.column-right {
margin-left: 3%;
}
#container input#tab-1:checked ~ #content #content-1,
#container input#tab-2:checked ~ #content #content-2,
#container input#tab-3:checked ~ #content #content-3
{
opacity: 1;
z-index: 100;
}
input.visible {
visibility: visible !important;
}
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(odd) {
background-color: #FFFFFF;
}
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd;
}
tr:hover{background-color:#96DCF7}
在代碼中,您可以輸入以下內容:
input.visible {
visibility: visible !important;
}
但是您也有:
input {
visibility: hidden;
}
您永遠不會在顯示給我們的代碼上引用.visible類,因此它保持隱藏狀態。 也許這就是問題所在。 嘗試將class="visible"
添加到輸入中。
<tr>
<td>
<input class="visible" type="image" style="height:25px; width:25px;" src="plus.png">
</td>
</tr>
嘗試使用CSS。 添加style=" background-image: url("plus.png");"
輸入標簽。 input type="image"
是type屬性的無效屬性。
這似乎是與您的html交互的其他代碼的問題。 以下代碼對我有用:
<table>
<thead>
<tr>
<th>Image</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="image" src="Image.png"></td>
</tr>
</tbody>
</table>
也許您應該從這里開始,然后一點一點地添加樣式,直到找到導致問題的原因。
編輯:我復制了您在此處放置的所有代碼,並假定您有一個具有容器ID的div和另一個具有內容ID的div,並且您的表位於其中。 按照@Benjamin Naesen的建議,我將可見性設置為visible,然后圖片出現了。
input.visible {
visibility: visible;
}
它能為您提供幫助嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.