NHS logo PNG fallback HTML validation errors #572
Labels
🕙 hours
A well understood issue which we expect to take less than a day to resolve
header
help wanted
Extra attention is needed
🔍 investigation
Milestone
Description
The NHS (SVG) logo in the Header has a PNG fallback for Internet Explorer 8 (which doesn't support SVG logos). The way we do this is by using the
<image>
element with asrc
attribute pointing to our PNG fallback, along with an emptyxlink:href
attribute to ensure that Internet Explorer 11/10 does not download both the SVG and the PNG logos. This is following the guidance on: https://css-tricks.com/a-complete-guide-to-svg-fallbacks/#fallback-inline-svg-imgtagHowever when running the Header component (https://nhsuk.github.io/nhsuk-frontend/components/header/index.html) through an HTML validator (https://validator.w3.org/) there are 3 errors found on the
<image>
element:The first error, attribute src not allowed on element image at this point, looks like it might be unavoidable validation error from early investigation (could be worth investigating further). But we could possibly look at adding an
height
andwidth
attribute to the<image>
fallback element to fix the remaining 2 errors.Initially it looks like adding
width="40" height="100"
to<image src="https://assets.nhs.uk/images/nhs-logo.png" xlink:href="" width="40" height="100"></image>
works fine. But when testing this on Internet Explorer 9 and 10, it gives an empty box overlaying the header:Setting the
width
and theheight
sizing with CSS on the fallback image doesn't seem to change much either. We could possiblydisplay: none
the fallback image on everything expect.ie8
.It would be good to investigate if we can fix any (or all) of these HTML validation errors.
Related
GOV.UK Frontend have managed to fix the
height
andwidth
validation errors, without the strange empty box overlay, so this may be something to do with our SVG markup or styling. (https://github.com/alphagov/govuk-frontend/blob/master/package/govuk/components/header/template.njk#L42).The attribute src not allowed on element image at this point error, seems to still be an issue there also.
The text was updated successfully, but these errors were encountered: