+ 1

Whats is the purpose of having comment in css ?

I couldn't get it properly , can anyone explain .

26th Aug 2017, 1:44 PM
Suntharapandiyan R
Suntharapandiyan R - avatar
3 Answers
+ 7
the purpose of comments is to make you/others better understand the code like why did you do something like, that style you applied. it is fresh in your mind but after days, week, months you will forget that function, code, style, etc. what about other people reading your code will you expect them to read your 100s, 1000s, or 10^9 lines of code without explanation? comments are for humans so they understand code without analysing every line of code in too much depth try to analyse this codes do you understand them with/without comments. https://code.sololearn.com/WjXBaep9yLwp/?ref=app https://code.sololearn.com/W036KVrrPlPt/?ref=app https://code.sololearn.com/WpV7E3wjLUTX/?ref=app https://code.sololearn.com/cCCSQqmJuYvd/?ref=app
26th Aug 2017, 1:57 PM
Lord Krishna
Lord Krishna - avatar
+ 12
A CSS comment is used to add explanatory notes to the code or to prevent the browser from interpreting specific parts of the style sheet. By design, comments have no effect on the layout of a document.
26th Aug 2017, 1:55 PM
P R
P R - avatar
+ 4
To make life easier for someone else who will possibly read the code, or to remind yourself why you did something 3 years ago. To test different styles without need to write old code again from the start.
26th Aug 2017, 1:59 PM
milan.k