☑️SOLVED☑️How do you place text beside an image in HTML?☑️SOLVED☑️ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

☑️SOLVED☑️How do you place text beside an image in HTML?☑️SOLVED☑️

I haven't learnt CSS yet. And how can I write the text beside (right or left to) the image

5th Apr 2021, 7:08 AM
Aadhya
Aadhya - avatar
14 Answers
5th Apr 2021, 10:56 AM
SAN
SAN - avatar
+ 6
5th Apr 2021, 9:59 AM
Aadhya
Aadhya - avatar
+ 6
Thanks ŚĄŃ [Exams] 😊, but I asked BESIDE an image, not ON TOP of the image
5th Apr 2021, 10:26 AM
Aadhya
Aadhya - avatar
+ 5
You can place text next to the image like this : <label for="img">text here</label> <img id="img" width="100" height="100">
5th Apr 2021, 7:40 AM
Mohammed Alotaibi
+ 5
Mohammed Alotaibi I tried doing that but it didn't work....
5th Apr 2021, 10:20 AM
Aadhya
Aadhya - avatar
+ 5
Thank you so much San!!!! I'm so sorry for bothering you😅😅
5th Apr 2021, 11:04 AM
Aadhya
Aadhya - avatar
+ 5
Ok, thank you Mohammed Alotaibi !
5th Apr 2021, 1:50 PM
Aadhya
Aadhya - avatar
+ 4
Thank you Mohammed Alotaibi and Ярослав Вернигора(Yaroslav Vernigora) I'll try and see if it works 😊
5th Apr 2021, 8:09 AM
Aadhya
Aadhya - avatar
+ 2
Hi! try to learn all the same
5th Apr 2021, 7:41 AM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
5th Apr 2021, 10:24 AM
SAN
SAN - avatar
+ 1
Hi There is more than one way to line up the text next to the image or any element you want . by using CSS code we create <div> element and assign ID's to it then write the code between <style> tag inside <head> tag .. see the following example * I added #myP #myImg For you to try it <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> #myDiv{ display: flex; } #myP { margin: auto; } #myImg { margin: auto; } </style> </head> <body> <div id="myDiv"> <div id="myImg"> <img width="100" height="100"> </div> <div id="myP"> <p>my text here</p> </div> </div> </body> </html> I recommend that you read some of the explanations of the CSS, to get more information about it
5th Apr 2021, 11:58 AM
Mohammed Alotaibi
+ 1
Use figure and figcaption : <figure> <img "" /> <figcaption> some text </figcaption> </figure>
6th Apr 2021, 6:04 AM
Ⓘⓣ ' 𝐬 𝐒𝐡𝐚𝐡𝐞𝐞𝐫 °•✮•°
Ⓘⓣ ' 𝐬 𝐒𝐡𝐚𝐡𝐞𝐞𝐫 °•✮•° - avatar
0
it worked soo cool
28th Apr 2023, 3:31 PM
MusaMaster