Pink Bow Slippers Scuff Laura Embroidered Terry Ashley Ladies Dots Soft wn86fz Pink Bow Slippers Scuff Laura Embroidered Terry Ashley Ladies Dots Soft wn86fz Pink Bow Slippers Scuff Laura Embroidered Terry Ashley Ladies Dots Soft wn86fz Pink Bow Slippers Scuff Laura Embroidered Terry Ashley Ladies Dots Soft wn86fz Pink Bow Slippers Scuff Laura Embroidered Terry Ashley Ladies Dots Soft wn86fz

Why indent your code? Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7

Let's look at some examples of coding techniques to make it clear why you should indent your HTML.

Wrong method 1: Everything on one line Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.p>

Problems:

  • Hard to figure out where code ends & text/content begins
  • Hard to see where the

    is, even with wrapping turned on

Wrong method 2: 3 lines, but no indentation Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7Patent Black Oxfords Carolbar Toe Shoes Round Lace Leather Women's Wedges Platform up qqTCP5w

<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation 
ullamco laboris nisi ut aliquip ex ea commodo consequat.
p>

OR

<p> 
<Ladies Soft Laura Dots Terry Slippers Ashley Pink Embroidered Bow Scuff a href="http://en.wikipedia.org/wiki/H._P._Lovecraft">H. P. Lovecrafta> 
p>

Problem: Because everything is at left margin, hard to differentiate code & text/content

Best method: indent text/content Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7

<p> 
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
    incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
    exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 
Embroidered Laura Ashley Dots Bow Soft Terry Slippers Ladies Pink Scuff p>

Advantages:

  • Start (

    ) & end (

    ) are at same level, so it's easy to see that you've closed code & also see where code starts & ends
  • Easy to differentiate between code & text/content

Examples of code indentation Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7

Here are some examples of how WebSanity likes to indent our code.

Block-level elements Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7

<p> 
    Lorem ipsum. 
p>
<p> 
    Lorem ipsum 
    <br>Dolor sit amet 
p>
<blockquote> 
    <p> 
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt
        ut labore et dolore magna aliqua. 
    p> 
blockquote>

Note: Notice how text/content is indented inside

, and then

is indented inside Bow Soft Slippers Embroidered Laura Ashley Terry Scuff Pink Dots Ladies

. This is called nesting. See how easy it is to tell what's a child of what?

<table> 
    <tr> 
        <td> 
            Lorem ipsum dolor sit amet 
        td> 
        <td> 
            Consectetur adipisicing 
        td> 
    tr> 
    <tr> 
        <td> 
            Lorem ipsum dolor sit amet 
        Bow Soft Dots Embroidered Terry Scuff Laura Ladies Slippers Ashley Pink Slippers Embroidered Bow Ashley Ladies Soft Dots Terry Pink Laura Scuff td> 
        <Embroidered Ladies Bow Terry Laura Pink Scuff Soft Dots Slippers Ashley td> 
            Consectetur adipisicing 
        td> 
    tr> 
table>

Note: Again with the multiple levels of indenting—but it should be obvious how much it helps reading that code!

Exceptions Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7

<h1>Title of the pageh1>

Note: We don't indent

& other headers because they're short, but if you want to indent , that would be fine.

<head><title>Document titletitle>
head>

Note: Again, we don't indent </code> & most other items inside <head> because they're short. </p> </blockquote> <pre><code class="html hljs "><span class="hljs-tag"><<span class="hljs-title">ul</span>></span> <span class="hljs-tag"><<span class="hljs-title">li</span>></span>Lorem<span class="hljs-tag"></<span class="hljs-title">li</span>></span> <span class="hljs-tag"><<span class="hljs-title">li</span>></span>Ipsum<span class="hljs-tag"></<span class="hljs-title">li</span>></span> <span class="hljs-tag"><<span class="hljs-title">li</span>></span>Dolor<span class="hljs-tag"></<span class="hljs-title">li</span>></span> <span class="hljs-tag"></<span class="hljs-title">ul</span>></span></code></pre> <blockquote> <p> Note: We don't indent <code><li></code> because most of the time the contents are short, because we're more concerned about the <code><ul></code> & <code></ul></code>, & because it can really lengthen the overall code. That said, if you want to indent <code><li></code>, feel free. </p> </blockquote> <h2 id="inline-examples"> Inline elements <a href="http://www.laowhining.com/Nbpu_Side_Ankle_Peep_Cambridge_Blush_Chunky_Wedge_Bootie_Cutout_Women's_Platform_Toe_Select_qTWzIw7-oveev/13.html" title="Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7">Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7</a></h2> <p> You never indent inline elements. Treat them like text/content. Examples: </p> <pre><code class="html hljs "><span class="hljs-tag"><<span class="hljs-title">p</span>></span> Lorem ipsum <span class="hljs-tag"><<span class="hljs-title">strong</span>></span>dolor sit amet<span class="hljs-tag"></<span class="hljs-title"><big>Ladies Slippers Ashley Laura Terry Dots Scuff Bow Soft Pink Embroidered</big> strong</span>></span>, consectetur adipisicing elit, sed do <span class="hljs-tag"><<span class="hljs-title">em</span>></span>eiusmod tempor<span class="hljs-tag"></<span class="hljs-title">em</span>></span> incididunt ut labore et <span class="hljs-tag"><<span class="hljs-title">code</span>></span>dolore magna aliqua<span class="hljs-tag"></<span class="hljs-title">code</span>></span>. Ut enim ad minim veniam, <span class="hljs-tag"><<span class="hljs-title">font</span> <span class="hljs-attribute">size</span>=<span class="hljs-value">"5"</span>></span>quis nostrud<span class="hljs-tag"></<span class="hljs-title">font</span>></span> exercitation ullamco <span class="hljs-tag"><<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">"http://www.demonoid.me"</span>></span>laboris nisi ut aliquip<span class="hljs-tag"></<span class="hljs-title">a</span>></span> ex ea commodo consequat. <span class="hljs-tag"></<span class="hljs-title">p</span>></span></code></pre> <pre><code class="html hljs "><span class="hljs-tag"><<span class="hljs-title"><strong>Dots Pink Soft Terry Laura Embroidered Slippers Ashley Ladies Scuff Bow</strong> blockquote</span>></span> <span class="hljs-tag"><<span class="hljs-title">p</span>></span> Lorem ipsum dolor sit amet, <span class="hljs-tag"><<span class="hljs-title">a</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">"http://www.avclub.com"</span>></span>consectetur adipisicing elit<span class="hljs-tag"></<span class="hljs-title">a</span><a href="http://laowhining.com/Shoes_Slippers_Memory_Fuzzy_Outdoor_Navy_House_Indoor_Skid_Foam_Anti_Women_Flip_Flops_wf6Pqx-fzwfy/16.html" title="Shoes Slippers Memory Fuzzy Outdoor Navy House Indoor Skid Foam Anti Women Flip Flops wf6Pqx">Shoes Slippers Memory Fuzzy Outdoor Navy House Indoor Skid Foam Anti Women Flip Flops wf6Pqx</a>></span>, sed do <span class="hljs-tag"><<span class="hljs-title">strong</span>></span>eiusmod tempor<span class="hljs-tag"></<span class="hljs-title">strong</span>></span> incididunt ut labore et <span class="hljs-tag"><<span class="hljs-title">em</span>></span>dolore<span class="hljs-tag"></<span class="hljs-title">em</span>></span> magna aliqua. <span class="hljs-tag"></<span class="hljs-title">p</span>></span> <span class="hljs-tag"></<span class="hljs-title">blockquote</span>></span></code></pre> <h2 id="what-about-the-basic-structure"> What about the basic structure of a webpage? <a href="http://www.laowhining.com/Nbpu_Side_Ankle_Peep_Cambridge_Blush_Chunky_Wedge_Bootie_Cutout_Women's_Platform_Toe_Select_qTWzIw7-oveev/13.html" title="Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7">Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7</a></h2> <p> Look at the following code. You'd think that <code><head></code> & <code><big>Bow Soft Ashley Slippers Embroidered Scuff Dots Pink Ladies Terry Laura</big> <body></code> would be indented inside <code><html></code>—after all, they're children of <code><head></code>, so shouldn't they be indented? </p> <pre><code class="html hljs "><span class="hljs-tag"><<span class="hljs-title">html</span>></span> <span class="hljs-tag"><<span class="hljs-title">head</span>></span> <span class="hljs-tag"><<span class="hljs-title">title</span>></span>Document title<span class="hljs-tag"></<span class="hljs-title">title</span>></span> <span class="hljs-tag"></<span class="hljs-title">head</span>></span> <span class="hljs-tag"><<span class="hljs-title"><strong>Dots Pink Laura Terry Ashley Bow Scuff Ladies Soft Embroidered Slippers</strong> body</span>></span> <span class="hljs-tag"><<span class="hljs-title">h1</span>></span>Page title<span class="hljs-tag"></<span class="hljs-title">h1</span>></span> <span class="hljs-tag"><<span class="hljs-title">p</span>></span> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt <span class="hljs-tag"></<span class="hljs-title">p</span>></span> <span class="hljs-tag"></<span class="hljs-title">body</span>></span> <span class="hljs-tag"></<span class="hljs-title">html</span>></span></code></pre> <p> So why aren't <code><head></code> & <code><body></code> indented? A couple of reasons: </p> <ul> <li>You know that <code><head></code> & <code><body></code> are the children of <code><html></code>; in fact, they're <em>always</em> the <em>only</em> children of <code><html></code>, so there's no need to remind yourself of this via nesting</li> <li>You save yourself one level on indentation; when you start nesting HTML inside HTML inside HTML inside HTML, this can add up</li> </ul> </div> <h2 id="your-text-editor">Your text editor should make it easy to indent your code<a href="http://www.laowhining.com/Nbpu_Side_Ankle_Peep_Cambridge_Blush_Chunky_Wedge_Bootie_Cutout_Women's_Platform_Toe_Select_qTWzIw7-oveev/13.html" title="Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7">Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7</a></h2><a href="http://laowhining.com/Black_Toe_Slide_Memory_Women_Indoor_Fur_House_Slippers_Faux_Foam_Open_Outdoor_Sandals_Fx7qAt-omtoh/11.html" title="Black Toe Slide Memory Women Indoor Fur House Slippers Faux Foam Open Outdoor Sandals Fx7qAt">Black Toe Slide Memory Women Indoor Fur House Slippers Faux Foam Open Outdoor Sandals Fx7qAt</a> <p>You could press tab or the space bar every single time you want to indent your code, but you shouldn't have to do that. Fortunately, good text editors help you out when it comes to indenting.</p> <h3 id="auto-indent">Auto-indent<a href="http://www.laowhining.com/Nbpu_Side_Ankle_Peep_Cambridge_Blush_Chunky_Wedge_Bootie_Cutout_Women's_Platform_Toe_Select_qTWzIw7-oveev/13.html" title="Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7">Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7</a></h3> <p>BBEdit, for instance, has a setting in its Preferences for "Auto-indent", which it defines as follows: "When this option is selected, pressing the Return key in new windows automatically inserts spaces or tabs to indent the new line to the same level as the previous line."</p> <p>Any good text editor should have a setting like this somewhere. The trick is finding it in the editor's Preferences or Options.</p> <h3 id="spaces-or-tabs-spaces">Spaces or tabs? (Spaces!)<a href="http://www.laowhining.com/Nbpu_Side_Ankle_Peep_Cambridge_Blush_Chunky_Wedge_Bootie_Cutout_Women's_Platform_Toe_Select_qTWzIw7-oveev/13.html" title="Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7">Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7</a></h3> <p>Should you use spaces or tabs for indenting? A debate has raged on this topic for decades, with different developers insisting that theirs is the right choice. WebSanity uses spaces, for various reasons, so that is the right choice, clearly.</p> <p>Your text editor should let you choose what gets inserted when you press the TAB key: a tab or spaces. Different text editors call that setting different things. Here are a few examples:</p> <ul> <li><strong>BBEdit</strong>: Preferences > Editor Defaults > Auto-expand tabs</li> <li><strong>Komodo Edit</strong>: Options/Preferences > Editor > Indentation > Prefer Tab characters over spaces</li> <li><strong>Notepad++</strong>: Preferences > Language Menu/Tab Settings > Replace by space</li> </ul> <p class="note">Note: If anyone knows of any others that I should add, let me know.</p><a href="http://laowhining.com/Brinley_Lace_Leather_Co_Heel_Pink_Cut_Booties_up_Elva_Perforated_Womens_Faux_Side_Out_rxr1gnq-rvxrx/8.html" title="Brinley Lace Leather Co Heel Pink Cut Booties up Elva Perforated Womens Faux Side Out rxr1gnq">Brinley Lace Leather Co Heel Pink Cut Booties up Elva Perforated Womens Faux Side Out rxr1gnq</a> <h3 id="how-many-spaces">How many spaces?<a href="http://www.laowhining.com/Nbpu_Side_Ankle_Peep_Cambridge_Blush_Chunky_Wedge_Bootie_Cutout_Women's_Platform_Toe_Select_qTWzIw7-oveev/13.html" title="Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7">Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7</a></h3> <p>The next question is, how many spaces get inserted when you press TAB? Basically, people either choose 2, 4, or 8 spaces. In WebSanity's opinion, 8 is far too many, 4 is acceptable but a bit too large, & 2 is just right. With 2, you can see the indentation, but lots of nesting doesn't push your code out to ridiculous lengths, as you can see in the following:</p> <p>Your text editor should let you choose how many spaces get inserted when you press TAB. Different text editors set that in different ways. Here are some examples:</p> <ul> <li><strong>BBEdit</strong>: Preferences > Editor Defaults > Tab width</li> <li><strong>Komodo Edit</strong>: Options/Preferences > Editor > Indentation > Number of spaces per indent</li> <li><strong>Notepad++</strong>: Preferences > Language Menu/Tab Settings > Tab size</li> </ul> <p class="note">Note: Again, if anyone knows of any others that I should add, let me know.</p> <h3 id="indenting-several-lines-at-once">Indenting several lines at once<a href="http://www.laowhining.com/Nbpu_Side_Ankle_Peep_Cambridge_Blush_Chunky_Wedge_Bootie_Cutout_Women's_Platform_Toe_Select_qTWzIw7-oveev/13.html" title="Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7">Nbpu Side Ankle Peep Cambridge Blush Chunky Wedge Bootie Cutout Women's Platform Toe Select qTWzIw7</a></h3> <p>What if you want to indent more than one line of code? Like 5? Or 25? You could manually move the cursor to the start of each line and press TAB the requisite number of times, but that would quickly grow tedious.</p> <p>Fortunately, every good text editor lets you select all the lines you wish to indent and then indent them all as a group. This is a fantastic time saver!</p> <p>Here's how various text editors enable you to indent lines at a group:</p> <ul> <li><strong>BBEdit</strong>: Highlight the lines & press TAB. To backdent the lines, press Shift-TAB.</li> <li><strong>Komodo Edit</strong>: Highlight the lines & press TAB. To backdent the lines, press Shift-TAB.</li> <li><strong>Notepad++</strong>: Highlight the lines & press TAB. To backdent the lines, press Shift-TAB.</li> </ul> </main> </div> <footer> <div class="container"> <div class="row"> <div class="col-sm-4"> <div id="HTMLBlock3787" class="HTMLBlock"> <div class="footer-col-1"> <h3>Contact</h3> <div id="home" class="vcard"> <table> <tbody> <tr> <td class="f">Email</td> <td class="v"><a class="email" href="mailto:scott@granneman.com">scott@granneman.com</a></td> </tr> <tr class="tel"> <td class="f type">Voice</td> <td class="v value"><a href="tel:1-314-780-0489">314-780-0489</a></td> </tr> <tr> <td class="f">Address</td> <td class="v"> <div class="adr"> <div class="street-address"> 39 Summit Place </div> <span class="locality">St. Louis</span>, <span class="region">MO</span> <span class="postal-code"><em>Ladies Pink Terry Embroidered Laura Soft Scuff Dots Ashley Bow Slippers</em> 63119</span><a href="http://laowhining.com/Light_Good_Boot_Aerosoles_Tan_Fun_Women's_Suede_wOFx4F-nimi/18.html" title="Light Good Boot Aerosoles Tan Fun Women's Suede wOFx4F">Light Good Boot Aerosoles Tan Fun Women's Suede wOFx4F</a> <div class="country-name"> United States </div> </div> </td> </tr> </tbody> </table> </div> <h3>Work</h3> <p> For work info, see <a href="/com">WebSanity</a>. </p> </div> </div> </div> <div class="col-sm-4"> <div id="HTMLBlock2299" class="HTMLBlock"> <p>All content, unless <a href="/presentations/creative-commons-license/">under a Creative Commons license,</a> is © 1997-2018 Scott Granneman.</p> <p>(Take a look around—a lot of content is licensed <a href="/presentations/creative-commons-license/">under a Creative Commons license,</a> which gives YOU a lot of freedom to reuse my work.)</p> </div> </div> <div class="col-sm-4"> <div id="HTMLBlock3788" class="HTMLBlock"> <ul class="list-unstyled social-media-icons"> <li><a href="/scottgranneman"><i class="fa fa-facebook-official"></i></a></li> <li><a href="/scottgranneman"><i class="fa fa-twitter"><strong>Scuff Dots Embroidered Soft Slippers Bow Pink Terry Ashley Ladies Laura</strong> </i></a></li> <li><a href="/profile"><i class="fa fa-linkedin"></i></a></li> <li><a href="http://www.laowhining.com/Hill_Mountain_45200_6"_Explorer_Boots_Sole_Side_Vibram_Hiking_GTX_USA_Waterproof_Outdoor_and_Leather_Traction_Combat_Gore_Made_Braking_Boot_Brown_Downhill_Danner_Women's_In_TEX_Boot_5qTwnWECzg-difcf/17.html" title="Hill Mountain 45200 6" Explorer Boots Sole Side Vibram Hiking GTX USA Waterproof Outdoor and Leather Traction Combat Gore Made Braking Boot Brown Downhill Danner Women's In TEX Boot 5qTwnWECzg">Hill Mountain 45200 6" Explorer Boots Sole Side Vibram Hiking GTX USA Waterproof Outdoor and Leather Traction Combat Gore Made Braking Boot Brown Downhill Danner Women's In TEX Boot 5qTwnWECzg</a></li> <li><a href="/user"><i class="fa fa-youtube-play"></i></a></li> <li><a href="/user"><i class="fa fa-lastfm"></i><a href="http://laowhining.com/Boot_Women's_Newbie_Black_Marc_Ankle_Fisher_962_fqwSFp0-pnhe/3.html" title="Boot Women's Newbie Black Marc Ankle Fisher 962 fqwSFp0">Boot Women's Newbie Black Marc Ankle Fisher 962 fqwSFp0</a></a></li> </ul> </div> </div> </div> </div> </footer> <a href="http://www.laowhining.com/Red_White_Striped_Spinnaker_Women's_Oxford_Sebago_Uwnq7tx-exmi/14.html" title="Red White Striped Spinnaker Women's Oxford Sebago Uwnq7tx">Red White Striped Spinnaker Women's Oxford Sebago Uwnq7tx</a> <div> <ul> <li><span>All Man Made materials</span></li> <li><span>POLYESTER COMPOSITION: The polyester composition ensures excellent warmth and insulation.</span></li> <li><span>MICRO TERRY UPR AND LINING: Having a micro terry upper and lining, the slippers are soft and plush.</span></li> <li><span>INDOOR/OUTDOOR SOLE: The sturdy sole makes the slippers suitable for indoor and outdoor use.</span></li> <li><span>CUSHIONING INSOLE: The slippers have a cushioning insole that offers optimal support and stability. SCUFF DOTS AND EMBROIDERED BOW DETAILS: The embroidered bow and scuff dots on the upper give a stylish upgrade to the slippers.</span></li> <li><span>Wash & Care: Spot Clean With Mild Detergent. Do Not Use Bleach. Air Dry.</span></li> </ul> </div> <div> <embed src="http://www.youtube.com/v/qqx9xo2TT9r?version=3&autohide=1" /> </div> </body> </html>