Skip to main content

HTML Guide

Bad value “x” for attribute “src” on element “img”: Tab, new line or carriage return found.

To fix the issue of having a bad value for the src attribute on an img element due to having a tab, new line, or carriage return, you need to ensure that the src attribute does not contain any additional whitespace characters like tab, new line, or carriage return.

Incorrect code:

<img src="images/example.jpg
" alt="Example Image">

Corrected code:

<img src="images/example.jpg" alt="Example Image">

By removing the extra whitespace characters (new line in this case) and ensuring that the src attribute value is properly enclosed within quotes, the issue should be resolved.

Learn more:

Related W3C validator issues