Help! Add an Image! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Help! Add an Image!

I really don’t know how to add an image on this app. I used different kinds of things like img and link and whatever. The link is correct. I also don’t know how to put in in the center. Align, margin-right:auto; text-align.. nothing works!! The img is at 20 in HTML and 23 in CSS. Please help! Thank you all! https://code.sololearn.com/W1GNudM64TXH/?ref=app

20th Jun 2018, 7:20 PM
Laura Kroon
Laura Kroon - avatar
6 Answers
+ 6
To center elements the use of <center> is currently not recommended, since it is not part of HTML 5. One solution would be to do the following: HTML: <div>      <img src = "http://www.laurakroon.nl/lauraa.jpg" width = "150px" height = "150px" /> </ div> CSS: div {      text-align: center; }
20th Jun 2018, 8:44 PM
Mickel
Mickel - avatar
+ 4
well. it worked for here.. i know i shouldn’t use it for ‘real’ websites. but other ways didn’t work until monique said i could use <center> next time i try out divs! :) wondering if the floats etc work here..
20th Jun 2018, 8:46 PM
Laura Kroon
Laura Kroon - avatar
+ 3
Thank you so beep much!!! I don’t know what <center> is or was, but it worked!!!! is it an older html?
20th Jun 2018, 8:41 PM
Laura Kroon
Laura Kroon - avatar
+ 2
In the HTML it should be ‘src’, not ‘scr’.
20th Jun 2018, 7:38 PM
Rora
+ 2
center its deprecated in HTML5... Remove it and use pure CSS like: img{ display:block; margin:0 auto; }
20th Jun 2018, 9:19 PM
KrOW
KrOW - avatar
+ 1
I changed the type error, but the picture still doesn’t show! :( thank you for helping me though! edit 22:23 : apparently I had to add http:// into it!? but ohh well! it shows now! now my other q: how to put it in the center? probably something simple too I just don’t see or forgot!
20th Jun 2018, 8:14 PM
Laura Kroon
Laura Kroon - avatar