How to add indents on tag so to not get confused?


#1

I'm not necessarily stuck or anything, it's just that once html gets more complex, I'll have to make my codes understandable and neat and they said to use indent. How do I add indents at every new tag? Is there any keyboard shortcut or anything?

Like this below. It's very simple but I don't know how to add or start an indent and I always have to copy paste every indent for every new line so the codes won't get all messy.


<html>
    <head>
        <title></title>
    </head>

    <body>
        <p>the indents are the spaces before every tag</p>
        <p>after every new tag the indent increases, right? So how do I do it???</p>
    </body>

</html>


#2

Hi you could add an indent four whitespace with the Tab on your keyboard

Windows

Mac I think it will be that


#3

That's a very useful answel, thank you.
But, if I deleted the indentation, How can I make the same indentation as the previous?
Such as below code, after I edit the

  • , are there any way for user to make the indentation for the < /ul >and </ li > aligning previous items?
    	</head>
    	<body>
    		<ol>
    			<li>Dad's interests
    				<ul>
    					<li>football</li>
    					<li>knitting</li>
    				</ul>
    			</li>
    			<li>Mom's interests
    				<ul>
    					<li>hating football</li>
    					<li>skydiving</li>
    				</ul>
    			</li>
    		</ol>
    	<ul>

    #4

    yea, simple use the backspace key to remove indention (or delete key)


    #5

    HI I don't understand what you mean by aligning previous items? do you mean something like that?

    <ul>
        <li>football</li>
        <li>knitting</li>
    </ul>

    if is it hat you just have to remove some whitespce before the <li> tag .


    #6

    Yes remove some whitespace is find, but I am concerned about the situation when there is a large code for this way, for example , < body> in the first code page and the < /body> in the second code page, it is difficult to make them in the same indentation


    #7

    well, if you are going to code big projects in codecademy's IDE i would declare you mad. If you use tabs, removing indent should be pretty easy. If you are going to do bigger projects, take time to set up your developers environment and figure out how to indent, and what the indent settings are (for most editors, you can change this)


    #8

    haha, I see. I think I have concerned too much.