Menü schliessen
Created: December 6th 2011
Last updated: May 1st 2020
Categories: Joomla
Author: Marcus Fleuti

Joomla :: TinyMCE always adds border="0" to img tags

Tags:  Joomla,  TinyMCE
Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

The problem

The TinyMCE editor always adds border="0" to img tags. This becomes annoying when using the HTML5 (strict) doctype because border="0" or similar tags are depreciated.

The solution

Edit /plugins/editors/tinymce/tinymce.php and change the array $elements like this

Original line:

$elements[] = 'img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style]';

New line (without border=0, height, width, align, vspace, hspace)

$elements[] = 'img[class|src|alt|title|onmouseover|onmouseout|name|style]';

The easiest way to find the correct line is by searching for "border=0" within the file.
Hint: For the current version (1.5) the line can be found @ line #412