15

How do i change the image size? I’ve used the below line of code to insert my image but i cannot seem to figure out how you make it smaller

html.Div(html.Img(src=app.get_asset_url('logo.png')))

i’ve tried:

html.Div(html.Img(src=app.get_asset_url('logo.png')),style={'height':'10%'})

any suggestions

Maths12
  • 852
  • 3
  • 17
  • 31

2 Answers2

27

Move your style attribute inside Img:

html.Div(html.Img(src=app.get_asset_url('logo.png'), style={'height':'10%', 'width':'10%'}))

Probably width is redundant but I'm not sure.

Kostas Charitidis
  • 2,991
  • 1
  • 12
  • 23
0

Try mentioning the style inside the html.Img() call, given as follows:

html.Img(src=app.get_asset_url('logo.png'),style={'height':'100%','width':'100%'}) 

if you want to fit the image exactly to the page, use 100%. Else reduce the % of height and width accordingly