Doubt regarding Attributes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Doubt regarding Attributes

Hello, I am new to HTML, I have a small doubt regarding attributes, Should I use specific name or any variable to change specific thing ? For example : If I want to change width of horizontal line, Should I must use width = "50px" or can I use something = "50px"? In detail : SoloLearn Code : <hr width = "50px"> My code : < hr something = '50px'> Note : I must have tested it, But people clarifing doubts is the best way to learn for me !..

10th Apr 2018, 6:07 AM
Sai Eshwar
Sai Eshwar - avatar
7 Answers
+ 1
No programming languages don't consider fixed syntax as variables. that would be like saying you could write a for loop by doing apple( var i = 0; i < 10; i ++) {} the attributes in html are the same. they are fixed names that are a part of the W3C standard for the language.
10th Apr 2018, 6:56 AM
Adam
Adam - avatar
+ 1
if you want to change the width you say width="50px" what else would you use to change the width?
10th Apr 2018, 6:45 AM
Adam
Adam - avatar
+ 1
no. it doesn't make sense. if you want to change the width why would you say blue="50px" or if you want to alter the color why would you say camel="red"?
10th Apr 2018, 6:50 AM
Adam
Adam - avatar
+ 1
Adam thanks for the clarification !. :D, Have a Great day :D !.
10th Apr 2018, 7:03 AM
Sai Eshwar
Sai Eshwar - avatar
+ 1
and you too. :)
10th Apr 2018, 7:10 AM
Adam
Adam - avatar
0
Adam , That's What I am asking, Is there a chance to use any variable?
10th Apr 2018, 6:46 AM
Sai Eshwar
Sai Eshwar - avatar
0
Adam I am asking this because, many programming languages consider them as variables, and We can give them any name !. So, Finally doubt, How does Html editor know the attribs ?
10th Apr 2018, 6:52 AM
Sai Eshwar
Sai Eshwar - avatar