How to create and add new elements to an HTML page with JavaScript and CSS

1 Answer

0 votes
<!DOCTYPE html>
<html>
<head>
<script>document.createElement("myElement")</script>
<style>
myElement {
  display: block;
  background-color: #D3F6A3;
  padding: 20px;
}  
</style>
</head>
<body>

<myElement>My Element</myElement>

</body>
</html>

 



answered Jan 8, 2019 by avibootz
...