Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Element img is missing required attribute src. #992

Open
IrynaShcharbakova opened this issue Aug 31, 2023 · 2 comments
Open

Error: Element img is missing required attribute src. #992

IrynaShcharbakova opened this issue Aug 31, 2023 · 2 comments
Labels

Comments

@IrynaShcharbakova
Copy link

Describe your problem/question
When I go to https://validator.w3.org/ to validate HTML of my website, I get an
Error: Element img is missing required attribute src.

You can check your demo page http://afarkas.github.io/lazysizes/#examples and see that error.
It is true when I replace img by data-src, it affects the HTML structure. The browser does not see image anymore. Or am I wrong?
Anyway could you please help to get rid of this error?

Thank you
P.S. I have searched but I did not find that issue in the history.

Add tags/keywords
img, error, HTML error, attribute

⚠️ Search for existing open/closed issues/discussions before you ask your question.
⚠️ I work on my spare time on helping users out. This means make it easy for me to simply see your live problem and help to fix it.
🤘 No panic: Don't be afraid to ask a question.

@RawMajkel
Copy link

Try adding src="#".

<img src="#" data-src="/path/to/image" class="lazyload">

@saas786
Copy link

saas786 commented Feb 1, 2024

@IrynaShcharbakova

Read: https://github.com/aFarkas/lazysizes?tab=readme-ov-file#broken-image-symbol

You could consider doing something similar to...

<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-src="/path/to/image" class="lazyload">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants