0

How do I learn to indent Code So That It is "Easy-to-Read" and "Beautiful"?

I'm new to coding but get how to code, that's the easy part. The hard part is learning how to indent & what to indent. I either under indent and make the code hard to read or I over indent for every new tag (HTML & CSS for example since I'm currently doing that) and you have to scroll to the right. I look, but with all the various methods it's hard to find a good one. I saw this website though with a good example & the code is Very Very Readable! https://css-tricks.com/examples/CleanCode/Beautiful-HTML.png

2nd Dec 2016, 10:23 PM
BrightAsTheStars
3 Réponses
+ 2
Here's what I do: For any elements/data inside of the head and body, indent them immediately. Let's say one of those elements is a div and you have even more elements inside of that. Indent all of the elements inside if the div. Force yourself to do this and you'll make it a habit out of yourself to do it every time to create clean code with a clear hierarchy. Good luck!
6th Dec 2016, 2:34 AM
Nikhil Kolachalama
Nikhil Kolachalama - avatar
+ 2
@BrightAsTheStars Awesome!
6th Dec 2016, 3:25 AM
Nikhil Kolachalama
Nikhil Kolachalama - avatar
0
@Nikhil Kolachalama Thanks, I have begun practicing as such and it really is nice, clean, and easy to read.
6th Dec 2016, 3:23 AM
BrightAsTheStars