user3376486
user3376486

Reputation: 33

Limitations of customizing HTML tags and attributes with CSS

I have been exploring with CSS and HTML this morning, and I'd like to know if there is any limitation while customizing HTML tags and attributes with CSS.

This example may help:

<div class="app"></div>

the style for the class app is:

.app { background: black; }

Now changing the HTML so the class is now an HTML tag and in the CSS, instead of creating a class, we change it to an HTML attribute like this:

HTML <app></app>

CSS [app] { background: black; }

Will this approach work cross-browser?, also, would the performance on the page load stay the same?

I've already tested with Chrome and Firefox and they work with no problem.

Upvotes: 0

Views: 98

Answers (1)

ElGavilan
ElGavilan

Reputation: 6924

It may work on most browsers, but creating custom tags is not supported in HTML. You may risk compatibility and possibly undefined behavior with some browsers. Not to mention this would also be bad for SEO, if that is a concern.

Stick with valid HTML tags, and use CSS classes to style them.

Upvotes: 1

Related Questions