can i put style inside of the text styling tag? example: <b style="color:red"> bold text</b> is it allowed to do that? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can i put style inside of the text styling tag? example: <b style="color:red"> bold text</b> is it allowed to do that?

16th Oct 2018, 4:13 AM
mon
mon - avatar
3 Answers
+ 3
Yes, this is called inline css. Anyway note that though in small web pages you can use it without take cure of it, in large pages its good practice NOT use it because it make more hard to mantain pages. Try to keep separate content (html) from presentation (css). Futhermore inline css have max priority respect to external and with style tag (this mean that if you declare same css prop on same element in different way, inline get priority)
16th Oct 2018, 5:59 AM
KrOW
KrOW - avatar
+ 1
YEP !
16th Oct 2018, 4:45 AM
Niush
Niush - avatar
+ 1
which one is better to do, use span or just put style inside the tag? example: (a) <p>This is an <span style="color:red"> <b>important</b> </span>message </p> (b)<p>This is an <b style="color:red">important </b>message </p>
16th Oct 2018, 9:08 AM
mon
mon - avatar