Inserting an image | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Inserting an image

Anyone help me with a bit of code. Still learning and I can’t for the life of me figure out why this isn’t working. Looks like this <div> <p class=“image1”><img src=“image.jpg” alt=“This image cannot be displayed”/> </p> </div> Cheers.

26th Feb 2019, 1:43 PM
Nival
7 Answers
26th Feb 2019, 1:55 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 1
Thank for this tutorial ! =)
26th Feb 2019, 2:03 PM
Christine Betbeder
Christine Betbeder - avatar
+ 1
Maybe the reference to the image file is incorrect? Make sure the file is in the same folder as the html file.
26th Feb 2019, 2:45 PM
marjel101
marjel101 - avatar
+ 1
you can use an event listener in javascript to wait for the keypress, and then change the style properties of the element on the screen that you want to change. A mouseclick might be a bit easier though, that’s probably possible with a pseudo element in your CSS.
26th Feb 2019, 7:55 PM
marjel101
marjel101 - avatar
+ 1
Just add some CSS: /* mouse over link */ a:hover { border: 1px solid white; } /* selected link */ a:active { border: 1px solid white; } Choose the right border style, color etc. and add it to the stylesheet
26th Feb 2019, 8:00 PM
Pete Wright
Pete Wright - avatar
0
still doesnt work. i must be doing somethinf obviously wrong
26th Feb 2019, 2:28 PM
Nival
0
is there anyway to get the border to ‘light’ up on a keypress?
26th Feb 2019, 7:48 PM
Nival