Anki Forums

Adding background image

I tried adding a background image to my Anki deck. It didn’t work.

In the media collection file is added an image file titled :

image.jpg

Taking the following coding, I tried putting this in the styling section :

body {
  background-image: <img src="image.jpg">;
  background-repeat: no-repeat;
  background-attachment: fixed; 
  background-size: 100% 100%;
}

I also tried in place of <img src="image.jpg"> :

img src="image.jpg"
img src=image.jpg
img src='image.jpg'

None of these alternatives worked.

Try background-image: url("image.jpg");

2 Likes

In addition to ankipalace’s answer, I suggest renaming the image.jpg file to _image.jpg to make the Check Media function recognizes the file as used.

See https://docs.ankiweb.net/#/templates/fields?id=static-soundsimages for more details.

2 Likes