Hi Readers!
The other day I was experimenting a little with CSS and this is what I came up with.
<style>
imsocool {
color:blue;
}
</style>
<body>
<imsocool>HELLO</imsocool>
</body>
I was surprised to see that this worked perfectly.
Output :
![](http://findnerd.s3.amazonaws.com/imagedata/6528/6528.png)
So, why do we not use made-up elements like these since they work effectively.
But, even more important question here is : How and why does CSS work with fake elements?
Most browsers today, are designed such that they are already fast forward compatible with possible future additions to HTML to some degree. That is, unrecognized elements are beforehand parsed into the DOM.
Thus, whenever a new element is added to the HTML specification, languages like CSS, JavaScript are used to provide the functionality required in older browsers. For this, the new elements have to appear in the DOM so that the languages are able to manipulate them and can easily add to that functionality.
But since, this work is still in its early stages of development, it should possibly be avoided until anything gets finalized.
Reasons for not using made-up elements :
HTML provides meaning to the data. The made up tags do not add any meaning to data. This is one of the many reasons why we don't use them. The other reasons are :
- They do not conform to the HTML specification.
- They might conflict with standard elements in the future if there comes any with the same name.
- Custom tags are already invalid in HTML
Keep Coding!
0 Comment(s)