Should I use non-standard tags in a HTML page for highlighting words?

Posted by rcs20 on Programmers See other posts from Programmers or by rcs20
Published on 2012-02-09T16:29:24Z Indexed on 2012/03/31 17:42 UTC
Read the original article Hit count: 483

Filed under:
|
|

I would like to know if it's a good practice or legal to use non-standard tags in an HTML page for certain custom purposes.

For example:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam consequat, felis sit amet suscipit laoreet, nisi arcu accumsan arcu, vel pulvinar odio magna suscipit mi.

I want to highlight "consectetur adipiscing elit" as important and "nisi arcu accumsan arcu" as highlighted.

So in the HTML I would put:

Lorem ipsum dolor sit amet, <important>consectetur adipiscing elit</important>. Nullam consequat, felis sit amet suscipit laoreet, <highlighted>nisi arcu accumsan arcu</highlighted>, vel pulvinar odio magna suscipit mi.

and in the CSS:

important {
 background: red
 color: white;
}

highlighted {
 background: yellow;
 color: black;
}

However, since these are not valid HTML tags, is this ok?

© Programmers or respective owner

Related posts about html

Related posts about syntax-highlight