user3467391
user3467391

Reputation: 11

Css background-image, image serving by tornado

I have an image server in tornado, the code is:

class Index(tornado.web.RequestHandler):
    def get(self):
       header = "image/png"
       ifile = open("image.png","r")
       self.add_header("Content-Type",header) 
       self.write(ifile.read()) 

I used this image in <img src="http://localhost:8888/img" /> and this works fine but it doesn't work when called in a css background-image, example: <div style="background-image:url(http://localhost:8888/img)"></div> .

Upvotes: 0

Views: 562

Answers (1)

Zaaferani
Zaaferani

Reputation: 951

your is correct but height of dev is 0 and for this resean not shown.

<div style="background-image:url(http://localhost:8888/img); min-height: 100px; background-repeat: repeat;">&nbsp;</div>

Upvotes: 2

Related Questions