Question in CSS | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Question in CSS

Do you really need to indent in CSS?

4th Aug 2022, 6:54 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
8 Answers
+ 4
Short answer: No. Long answer: Indentation is good practice and is used purely to write clear code. Code will look nicer and is much easier to work with. However it is also good practice to remove indentation and comments etc in your code when used online with a website. This proces is called minifying/compressing, it will automatically remove indentation and comments for you. So use identation and minify when deploying online. Common practice: style.css <- your file with identation style.min.css <- minified code for website There are enough extensions for VS Code that will do it automatically for you, and you also have enough online free minifying websites. It also applies to javascript.
6th Aug 2022, 6:43 AM
Ezzar
+ 6
You dont have to, but it is much easier to work with indented code. Thats why this is good practice.
4th Aug 2022, 7:10 PM
PanicS
PanicS - avatar
+ 3
AJ 🇺🇦#PeaceForUkraine🇺🇦 Did you write without indent? Did you get any problem? CSS/Html never give any error do you know?
4th Aug 2022, 6:59 PM
A͢J
A͢J - avatar
+ 3
AJ 🇺🇦#PeaceForUkraine🇺🇦 Indentation is always good for any language but only few languages compalsary needs indent like python. Html and CSS never gives any error so doesn't matter how you write code.
4th Aug 2022, 7:15 PM
A͢J
A͢J - avatar
+ 2
No we don't need indentation in css but we use indentation to make our code look much good, clean and clear.
5th Aug 2022, 3:52 PM
SIDDIQUE ZEESHAN AZAM
SIDDIQUE ZEESHAN AZAM - avatar
+ 1
A͢J I didn’t write without indent, I was just curious.
4th Aug 2022, 7:11 PM
MyNameIsNotBob
MyNameIsNotBob - avatar
0
No you dont need to
4th Aug 2022, 7:05 PM
John Doe
0
A͢J Ah, okay.
4th Aug 2022, 7:17 PM
MyNameIsNotBob
MyNameIsNotBob - avatar