简体   繁体   中英

How to put image in background in html

i am trying below codes to get image in background so i can write on it but image is not coming in background of row in table. image and html page.

<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 is not a table attribute, you need to use the style attribute to set a background image.

If you are applying background-color on tr then make td background transparent.

td{
    background-color: transparent;
}

you do can with

 <table style="black"> 

or even with css:

 td { background-color: black; } 

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