JSFiddle - React, Tailwind, and code Playground
by mehul0810
HTML
<html>
<body>
<input id="btn1" type="button" value="create div" onclick="createDiv();" />
</body>
</html>
CSS
.dynamicDiv {
width : 200px;
height : 100px;
border : solid 1px #c0c0c0;
background - color : #e1e1e1;
font - size : 11px;
font - family : verdana;
color : #000;
padding : 5px;
}
JavaScript
var divTag = document.createElement("div");
divTag.id = "div1";
divTag.setAttribute("align", "center");
divTag.style.margin = "0px auto";
divTag.className = "dynamicDiv";
divTag.innerHTML = "This HTML Div tag is created using Javascript DOM dynamically.";
document.body.appendChild(divTag);
}