Saturday, November 9, 2013
Creating custom HTML tags which support all Major Browsers
Do you know that we can create custom HTML elements/tags? when i got to know about it i was like WOW! that will be kinda awesome and hard. But later when i researched about it i found it's really easy for anyone to create custom HTML elements. You don't need to do thousands of lines of coding.
For creating a HTML element/tag you just need to write the name of it like the standard HTML element/tag.
For example:
<computer brand="Acer" price="28,900" ratings="4" id="pc">Acer Aspire R7</computer>
you are done by creating a custom HTML element. But this will only support all major browsers, excluding Internet Explorer.
To make the custom HTML tag work with Internet Explorer you'll just need to write a single line of Javascript.
<script type="text/javascript">
document.createElement("computer");
</script>
this will create an HTML element named as "computer".
Another point to note is, by default a custom element has a display inline. But you can change that with CSS.
<style type="text/css">
#pc {
display:block;
}
</style>
Liked the post ? subscribe us with your email to get upcoming tutorials directly in your inbox:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Your Comment Will Be Visible After Approval, Thanks !