USE;
Creating and Appending Elements Dynamically with JS.
Use the below reference image.
Achieve the given design using JS.
CSS Colors used:
Text colors Hex code values used:
#0000ff
<!DOCTYPE html>
<html>
<head></head>
<body>
<div id="myContainer"></div>
</body>
<script>
const container = document.querySelector('#myContainer');
const element = document.createElement("h1");
element.style.color = "#0000ff";
element.innerHTML = "My element inside the container";
container.append(element)
</script>
</html>
Comments