简体   繁体   中英

Showing background image in IE8

My background images aren't showing in IE8:

<tr>
    <td height="11"></td>
    <td height="11"></td>
    <td height="11" background="images/lgin-bg-blnk.jpg">kjsdfk</td>
</tr>

<td height="11" background="images/lgin-bg-blnk.jpg">kjsdfk</td>

presuming from the title you want a background image it should be in a style attribute like below, or even better in an external stylesheet..

<td height="11" style="background: url(images/lgin-bg-blnk.jpg);">kjsdfk</td>


background is not a valid HTML attribute for a TD , though it was a non-standard property that was supported by older Netscape and IE browsers see: TH/TD definition

  • id, class (document-wide identifiers)
  • lang (language information),
  • dir (text direction)
  • title (element title)
  • style (inline style information )
  • onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup (intrinsic events )
  • bgcolor (background color)
  • align, char, charoff, valign (cell alignment)

Added : reference for quotes/no quotes : W3C

background is not a valid attribute for a <td> element. Try changing it to an inline CSS style:

<td height=11 style="background:url('images/lgin-bg-blnk.jpg')">...</td>

您还必须指定宽度。

<td height="11" width="" style="background: url(images/lgin-bg-blnk.jpg);">kjsdfk</td>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM