PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, May 6, 2022

[FIXED] Why does the W3C validator show error messages for these IMG attributes?

 May 06, 2022     html, image     No comments   

Issue

I have an IMG tag in my HTML5 document that reads:

<img src="elements/background.png" alt="" width="100%" height="100%" />

When I run the document through the W3C validator (doctype is HTML5, encoding is UTF-8), it comes up with two error messages, one for the width attribute and one for the height attribute. Both say something to the effect of, "Expected a digit but saw % instead."

I checked on the W3C website, and the width and height attributes for the IMG tag both still support percentages in HTML5. What's going on?


Solution

According to W3C:

[...] The attributes, if specified, must have values that are valid non-negative integers.

4.8.16 Dimension attributes

Change the values to integers or use CSS.



Answered By - vinga
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing