如何在html页面中显示肖像图像

时间:2015-07-12 19:18:48

标签: html image

如何在html中显示肖像图像?我使用了img标记。我的肖像图像被旋转90度并以横向显示。

如何以原始方向显示图像?

1 个答案:

答案 0 :(得分:0)

为您的元素尝试此CSS:

#Initialize the game
pygame.init()
width, height = 640, 480
screen=pygame.display.set_mode((width, height))

#How I keep the player position
playerpos=[50,50]


#How I keep health bar above the player position
healthbarpos=[

playerpos + player x position ,player y position + 10 pixels


-----------------

#full bar 34 pixel minus 3 on each side so 28
healthvalue=28

#loading images for healthbar
healthbar = pygame.image.load("healthbar.png")
health = pygame.image.load("health.png")

#rest inside the while true loop

#Drawing health bar
    screen.blit(healthbar, (5,5))
    for health1 in range(healthvalue):
        screen.blit(health, (health1+8,8))
    #update the screen
    pygame.display.flip()

#Moving player in the event loop 

       #if a key is pressed
        elif event.type == KEYDOWN:
            #if the right arrow is pressed
            if event.key == K_RIGHT and playerPos[0] < MAPWIDTH - 1:
                #change the player's x position
                playerPos[0] += 1
            if event.key == K_LEFT and playerPos[0] > 0:
                #change the player's x position
                playerPos[0] -= 1
            if event.key == K_UP and playerPos[1] > 0:
                #change the player's x position
                playerPos[1] -= 1
            if event.key == K_DOWN and playerPos[1] < MAPHEIGHT -1:
                #change the player's x position
                playerPos[1] += 1