<h1>Multiplication Table</h1>
<div id="result"></div>
h1 {
  text-align: center;
}

#result {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial, Helvetica, sans-serif;
}

tr:nth-child(even) {
  background-color: #f2f2f2;
}

td,
th {
  border: 1px solid #000;
  padding: 8px;
}

th {
  color: white;
  background-color: #673ab7;
}

td {
  text-align: center;
}
let tbl = "<table>";

for (let i = 1; i <= 10; i++) {
  tbl += "<tr>";
  for (let j = 2; j <= 9; j++) {
    if (i == 1) {
      tbl += `<th>${j}Times</th>`;
    } else {
      tbl += `<td>${j} x ${i - 1} = ${j * (i - 1)}`;
    }
  }
  tbl += "</tr>";
}
tbl += "</table>";
document.getElementById("result").innerHTML = tbl;

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.