Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How create new container tag in html

i have read about this theme but not solved. Something similar to header and footer html tag with content. Ok it not standard html custom tag, but i want something like:

<html>
  <body>
    <content>
      This is a text
    </content>
  </body>
</html>

So, I have defined CSS as:

content {
  backuground-color: red;
  display: block;
  padding: 1em;
} 

And Javascript as:

var customTag = document.createElement('content');
var customTag = new customTag();
document.body.appendChild(customTag);           

But something not work. How i can fix problem? What i forget to do more? Thanks very much.

like image 542
Marcello Impastato Avatar asked Nov 23 '25 18:11

Marcello Impastato


1 Answers

<content> used to be an HTML tag (I think)...
Here's a way with <customcontent>, instead:

var cc=document.createElement("customcontent");
cc.innerText="Hello!  I'm a custom content tag!";
document.body.append(cc);
customcontent {
  background-color: red;
  display: block;
  padding: 1em;
} 
like image 159
iAmOren Avatar answered Nov 26 '25 06:11

iAmOren



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!