Shortcut to move indentation of a whole section

Hello guys.

I’m using Visual Studio Code and I face a problem with indentation.
I have created elements (h2, nav, section) and I’d like to put these elements in a div element.

How can I automatically adjust the indentation?

original code:


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cheat Sheet Project</title>
    <link rel="stylesheet" type="text/css" href="resources/css/styles.css">
</head>
<body>
    <header>
        <h1 class="banner">HTML & CSS CHEAT SHEET</h1>
    </header>

    <main>

        <h2>HTML (HyperText Markup Language)</h2>

        <nav>
            <li></li>
            <li></li>
            <li></li>
        </nav>

        <!--  HTML Elements-->

        <section>
            <h3>HTML Elements</h3>
            <p></p>
        </section>

        <section>
            <h3>Semantic HTML</h3>
            <p></p>
         </section>

with the div tag

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Cheat Sheet Project</title>
    <link rel="stylesheet" type="text/css" href="resources/css/styles.css">
</head>
<body>
    <header>
        <h1 class="banner">HTML & CSS CHEAT SHEET</h1>
    </header>

    <main>
        <div>
        <h2>HTML (HyperText Markup Language)</h2>

        <nav>
            <li></li>
            <li></li>
            <li></li>
        </nav>

        <!--  HTML Elements-->

        <section>
            <h3>HTML Elements</h3>
            <p></p>
        </section>

        <section>
            <h3>Semantic HTML</h3>
            <p></p>
         </section>
        </div> 

the tab key, select the lines you want to indent, then press <tab> key

or shift-tab to un-indent.

2 Likes

Great! Thanks a lot! :star_struck: