Adding JavaScript to your HTML file
Using the defer attriute
<head>
<script src="js-file.js" defer></script>
</head>The defer attribute ensures that your JavaScript code runs after the DOM is fully constructed but before the DOMContentLoaded event fires. This allows your code to access and manipulate the DOM elements safely, without the need to wait for the load event or place the <script> tag at the end of the <body> section.
Tables
- HTML tables are used to represent tabular data.
- Avoid using tables for layout. It’s inaccessible, not responsive, and hard to maintain.
- Use semantic elements:
<thead>,<tbody>,<tfoot>,<caption>, etc.
| Header 1 | Header 2 |
|---|---|
| Row 1, Cell 1 | Row 1, Cell 2 |
| Row 2, Cell 1 | Row 2, Cell 2 |