The <template> element holds HTML that isn't rendered until you clone and insert it.
<template id="card-template">
<div class="card"><h2></h2><p></p></div>
</template>
const template = document.getElementById("card-template");
const clone = template.content.cloneNode(true);
clone.querySelector("h2").textContent = "Title";
container.appendChild(clone);