html - 如何在html中将图像放在背景中

标签 html css

我正在尝试使用下面的代码在背景中获取图像,这样我就可以在上面写字,但图像不会出现在表格行的背景中。 图像和 html 页面。

<table background="aj1.jpg">
<tr>
<h4 align="center" style="font-size:20; font-family:Monotype Corsiva; color:black;">My Home</h4></tr>
<tr>
<h4 align="center" style="font-size:20; font-family:Monotype Corsiva; color:black;">Enjoy every moment.</h4>
</tr></table>

最佳答案

<table style = "background-image:url('aj1.jpg')">
<tr>
<td>
<h4 align="center" style="font-size:20; font-family:Monotype Corsiva; color:black;">My Home</h4></td></tr>
<tr>
<td><h4 align="center" style="font-size:20; font-family:Monotype Corsiva; color:black;">Enjoy every moment.</h4></td>
</tr></table>

background不是表格属性,需要使用style属性设置背景图片。

关于html - 如何在html中将图像放在背景中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20167823/

相关文章:

html - anchor 内的图像会导致错位

javascript - 当鼠标位于固定 div 之上时滚动底层 div 的方法?

php - 我如何使用 PHP "cloak"我的 Javascript 和 CSS 文件?

Jquery 设置单独的输入边框颜色

css - 是:before pseudo-element allowed on an input[type=checkbox]?

php - 如何通过php跳过段落中的某些单词

jquery - Github 将多个文件合并成一个压缩的主文件

javascript - 是否显示:none automatically means that iframe and it's content not exists?

jquery - 为什么我的整个代码不工作?

jquery - 如何使移动微调器的边缘变圆 css