HTML

cheatsheet
  1. HTML basic structure
  2. <!DOCTYPE html>
    <html>
    <head>
        <title>Title</title>
    </head>
    <body>
        <h1>Hello, World!</h1>
    </body>
    </html>
  3. HTML headings
  4. <h1>Heading 1</h1>
    <h2>Heading 2</h2>
    <h3>Heading 3</h3>
    <h4>Heading 4</h4>
    <h5>Heading 5</h5>
    <h6>Heading 6</h6>
  5. HTML paragraph
  6. <p>This is a paragraph.</p>
  7. HTML line break
  8. <p>This is the first line.<br>This is the second line.</p>
  9. HTML link
  10. <a href="https://www.example.com">Link</a>
  11. HTML image
  12. <img src="image.jpg" alt="Description">
  13. HTML list (unordered)
  14. <ul>
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
    </ul>
  15. HTML list (ordered)
  16. <ol>
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
    </ol>
  17. HTML table
  18. <table>
        <tr>
            <th>Header 1</th>
            <th>Header 2</th>
        </tr>
        <tr>
            <td>Data 1</td>
            <td>Data 2</td>
        </tr>
    </table>
  19. HTML form
  20. <form action="/submit" method="post">
        <input type="text" name="username">
        <input type="password" name="password">
        <input type="submit" value="Submit">
    </form>
  21. HTML div
  22. <div>This is a division.</div>
  23. HTML span
  24. <p>This is a <span>span</span> element.</p>
  25. HTML input (text)
  26. <input type="text" name="name">
  27. HTML input (password)
  28. <input type="password" name="password">
  29. HTML input (checkbox)
  30. <input type="checkbox" name="agree">
  31. HTML input (radio)
  32. <input type="radio" name="gender" value="male"> Male
    <input type="radio" name="gender" value="female"> Female
  33. HTML input (submit button)
  34. <input type="submit" value="Submit">
  35. HTML input (reset button)
  36. <input type="reset" value="Reset">
  37. HTML input (file)
  38. <input type="file" name="file">
  39. HTML input (number)
  40. <input type="number" name="quantity" min="1" max="5">
  41. HTML input (date)
  42. <input type="date" name="date">
  43. HTML input (email)
  44. <input type="email" name="email">
  45. HTML input (color)
  46. <input type="color" name="color">
  47. HTML input (range)
  48. <input type="range" name="range" min="0" max="100">
  49. HTML input (search)
  50. <input type="search" name="search">
  51. HTML input (tel)
  52. <input type="tel" name="phone">
  53. HTML input (url)
  54. <input type="url" name="website">
  55. HTML textarea
  56. <textarea name="message" rows="4" cols="50">
    Enter your message here.
    </textarea>
  57. HTML select
  58. <select name="cars">
        <option value="volvo">Volvo</option>
        <option value="saab">Saab</option>
        <option value="fiat">Fiat</option>
        <option value="audi">Audi</option>
    </select>
  59. HTML button
  60. <button>Click Me</button>
  61. HTML comment
  62. <!-- This is a comment -->
  63. HTML meta tag (charset)
  64. <meta charset="UTF-8">
  65. HTML meta tag (viewport)
  66. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  67. HTML link tag (stylesheet)
  68. <link rel="stylesheet" href="styles.css">
  69. HTML script tag (external)
  70. <script src="script.js"></script>
  71. HTML script tag (internal)
  72. <script>
        // JavaScript code here
    </script>
  73. HTML div with class
  74. <div class="container">
        
    </div>
  75. HTML div with id
  76. <div id="header">
        
    </div>
  77. HTML span with style attribute
  78. <p>This is a <span style="color: blue;">blue</span> word.</p>
  79. HTML image with width and height attributes
  80. <img src="image.jpg" alt="Description" width="200" height="150">
  81. HTML anchor tag with target attribute
  82. <a href="https://www.example.com" target="_blank">Link</a>
  83. HTML ordered list with type attribute
  84. <ol type="I">
        <li>Item 1</li>
        <li>Item 2</li>
        <li>Item 3</li>
    </ol>
  85. HTML unordered list with start attribute
  86. <ul start="3">
        <li>Item 3</li>
        <li>Item 4</li>
        <li>Item 5</li>
    </ul>
  87. HTML table with border attribute
  88. <table border="1">
        <tr>
            <td>Cell 1</td>
            <td>Cell 2</td>
        </tr>
        <tr>
            <td>Cell 3</td>
            <td>Cell 4</td>
        </tr>
    </table>
  89. HTML table with colspan and rowspan attributes
  90. <table border="1">
        <tr>
            <td colspan="2">Header</td>
        </tr>
        <tr>
            <td rowspan="2">Cell 1</td>
            <td>Cell 2</td>
        </tr>
        <tr>
            <td>Cell 3</td>
        </tr>
    </table>
  91. HTML table with caption
  92. <table border="1">
        <caption>Table Caption</caption>
        <tr>
            <td>Cell 1</td>
            <td>Cell 2</td>
        </tr>
        <tr>
            <td>Cell 3</td>
            <td>Cell 4</td>
        </tr>
    </table>
  93. HTML form with action and method attributes
  94. <form action="/submit" method="post">
        
    </form>
  95. HTML input (checkbox) with checked attribute
  96. <input type="checkbox" name="subscribe" checked>
  97. HTML input (radio) with checked attribute
  98. <input type="radio" name="gender" value="male" checked> Male
    <input type="radio" name="gender" value="female"> Female
  99. HTML input (text) with placeholder attribute
  100. <input type="text" name="username" placeholder="Enter your username">
  101. HTML input (password) with maxlength attribute
  102. <input type="password" name="password" maxlength="10">
  103. HTML input (number) with min and max attributes
  104. <input type="number" name="age" min="18" max="100">
  105. HTML input (date) with required attribute
  106. <input type="date" name="birthdate" required>
  107. HTML input (email) with pattern attribute
  108. <input type="email" name="email" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$">
  109. HTML input (file) with accept attribute
  110. <input type="file" name="avatar" accept="image/*">
  111. HTML select with multiple attribute
  112. <select name="fruits" multiple>
        <option value="apple">Apple</option>
        <option value="banana">Banana</option>
        <option value="orange">Orange</option>
    </select>
  113. HTML textarea with rows and cols attributes
  114. <textarea name="message" rows="4" cols="50">
    Enter your message here.
    </textarea>
  115. HTML button with type attribute
  116. <button type="submit">Submit</button>
  117. HTML comment
  118. <!-- This is a comment -->