How can I fix a background image to the same size as a table row in HTML?

  • Context: HTML/CSS 
  • Thread starter Thread starter ngkamsengpeter
  • Start date Start date
  • Tags Tags
    Programming Websites
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 3K views
ngkamsengpeter
Messages
193
Reaction score
0
I want to put a picture as a background image for the row in the table using html code but it doesn't exactly fixed in the row . it repeated or just using it original size . How can I do so that my picture fixed exactly that is same width and height as the table row or column?
 
Physics news on Phys.org
You can specify the width and height, i.e.:
<img src='' width='120px' height='200px' />
or just use 100%
<img src='' width='100%'height='100%' />
You can also use css to set the image as background without repeating.
 
Last edited:
-Job- said:
You can specify the width and height, i.e.:
<img src='' width='120px' height='200px' />
or just use 100%
<img src='' width='100%'height='100%' />
You can also use css to set the image as background without repeating.
If i specify the image width and height, when the user resize the window, the table row size is also resize and the image will not fit in the row again.The 100% mean the 100% of the image original size or the row size ? If I use css without repeating , the image will not fit exactly in the row but become too small compare to the row and left a space in the row . So , how can i do it ?