HostNed Community

WEB DESIGN DISCUSSIONS => Scripting => Topic started by: Dynaweb on April 09, 2015, 02:14:43 AM

Title: How To Use ALT Tags In BBCode
Post by: Dynaweb on April 09, 2015, 02:14:43 AM
One criticism of BBCode (http://www.dynawebdesigns.com/resources-html_to_bbc_converter.htm) is that it does not support alt tags for images (yes, properly the alt attribute (http://en.wikipedia.org/wiki/Alt_attribute), I know).  The alt is notoriously kind for SEO purposes and also for impaired visitors.

Well, I was toying around in the forum and discovered a way to make it work.  A bit of a little hack really.

Here is the format:

[img alt=here-is-the-alt]http://upload.wikimedia.org/wikipedia/commons/d/d6/ISO_639_Icon_alt.svg[/img]

And here it is parsed below...

(http://upload.wikimedia.org/wikipedia/commons/d/d6/ISO_639_Icon_alt.svg)

If you inspect the code of the page you will see the alt attribute is present.  Do not add quotes and use dashes or underscores (although you MIGHT be able to get away with spaces in some cases).  I can confirm this works on SMF BBcode, but have not tested elsewhere.