These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:11 pm Advanced search

<code> element description

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

<code> element description

Postby AMWJ » Sun Jun 13, 2010 11:11 pm

Is there an attribute in the <code> element should I use to describe what my code does. It would be very convenient for search engines to search code examples.
Also, why is there no attribute for the language the code is in? This would make searching for examples so much easier ( "HTMLDocument example:"Parse HTML" code:C#").
AMWJ
<h6>
 
Posts: 7
Joined: Sun Jun 13, 2010 10:47 pm

Postby zcorpan » Mon Jun 14, 2010 6:37 am

You could use title="" or put the description in surrounding prose. As for the language,

"Although there is no formal way to indicate the language of computer code being marked up, authors who wish to mark code elements with the language used, e.g. so that syntax highlighting scripts can use the right rules, may do so by adding a class prefixed with "language-" to the element."
http://www.whatwg.org/specs/web-apps/cu ... de-element
zcorpan
<article>
 
Posts: 807
Joined: Tue Feb 06, 2007 8:29 pm
Location: Sweden


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests