css样式
<style>
span {
display: inline-block;
width: 100px;
padding: 0 3px;
}
</style>
html结构
<body>
<div class="box">
</div>
</body>
js逻辑代码
<script>
let box = document.querySelector('.box');
let str = '';
for(let i=1; i<10; i++){
for(let j=1; j<=i; j++){
str += `<span>${j} * ${i} = ${i*j}</span>`
}
str += '<br/>'
}
box.innerHTML = str
</script>