What is the difference in using attributes and styling in html elements? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the difference in using attributes and styling in html elements?

Why we use <div style="background-image:url(' ')"> instead of simply making attribute to do<div background-image=" ">? I have learned only basic html so i wonder if this is a thing to know in future but i am just curious you know.

1st Jun 2020, 2:47 AM
Sameer Crestha
Sameer Crestha - avatar
6 Answers
+ 1
Sameer Crestha it sounds like you are confusing yourself with inline CSS and internal CSS ... and actual HTML attributes https://www.w3schools.com/tags/ref_standardattributes.asp
1st Jun 2020, 3:02 AM
BroFar
BroFar - avatar
+ 2
Ok thanks guys i am clear now.
1st Jun 2020, 3:28 AM
Sameer Crestha
Sameer Crestha - avatar
+ 1
How am i suppose to know what elements can have presentional attribute or/& inline style?
1st Jun 2020, 3:05 AM
Sameer Crestha
Sameer Crestha - avatar
+ 1
BroFar sorry i could not understand your suggestion please simplify it
1st Jun 2020, 3:17 AM
Sameer Crestha
Sameer Crestha - avatar
0
Sameer Crestha I would suggest you start by learning about both HTML and CSS tutorials verses asking a bunch of questions... that go toward the basics. Currently you have started neither.
1st Jun 2020, 3:08 AM
BroFar
BroFar - avatar