A paragraph with the text, 'I am a Nigerian. Lucky me.' I'm trying to select the words, 'Lucky me' to format them. Need help😭 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

A paragraph with the text, 'I am a Nigerian. Lucky me.' I'm trying to select the words, 'Lucky me' to format them. Need help😭

23rd Oct 2020, 8:55 PM
Onuoha Glide
Onuoha Glide - avatar
2 Answers
+ 4
use the <span> tag arround selected text. Learn more here ( https://www.w3schools.com/tags/tag_span.asp )
23rd Oct 2020, 10:40 PM
Galaxy-Coding (inactive)
Galaxy-Coding (inactive) - avatar
+ 1
How are you doing so? You will eventually need to wrap a element around the text you wish to format , or try some other method ! a better way instead of wrapping the span or other element around word is to use range object that sets a starting and ending range that you provide for a particular element text and then surround that range with an element using surroundContent method. Although using this method you are still wrapping an element around text but now you just need to set the new range offset positions for a particular element text instead of editing your html and placing an element to new position https://code.sololearn.com/W34wFZpUI3QU/?ref=app
23rd Oct 2020, 9:08 PM
Abhay
Abhay - avatar