HTML Guides for transition
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
The transition shorthand contains a token it doesn't accept, often a CSS-wide keyword like initial written next to other values.
transition takes one or more transitions separated by commas. Each one can list a property name (or all), a duration, a timing function such as ease or linear, and a delay. The validator quotes the token that doesn't fit. Browsers drop an invalid declaration entirely, so the element gets no transition from that rule.
CSS-wide keywords such as initial, inherit and unset are only valid as the whole value. transition: initial passes, but transition: all initial and transition: opacity 0.3s, initial don't. To turn transitions off, write transition: none. To animate, replace the keyword with a duration and, if you want one, a timing function.
The same message shows up for a misspelled or invented timing function like ease-in-out-slow, and for a duration or delay written without a unit. A bare 0 isn't a valid time, so write 0s.
Invalid example
<div style="transition: all initial;">Card</div>
Valid example
<div style="transition: all 0.3s ease;">Animated card</div>
<div style="transition: none;">Static card</div>
A Vue template left in the page's HTML puts a name attribute on <transition>, and the validator warns because HTML only defines name for a short list of its own elements.
<Transition> is the Vue component that animates an element as it is added to or removed from the page. Its name prop sets the prefix of the CSS classes Vue applies during the animation, so name="slide" gives you slide-enter-active, slide-leave-to and so on. When Vue mounts onto markup that is already in the page (an in-DOM template, common when Vue is loaded from a CDN without a build step), the browser parses that markup first, and the validator checks it before Vue has compiled anything. Tag names in HTML are case-insensitive, so writing the tag as <Transition> gets the same message.
The warning comes with two errors for the same tag. transition is not an HTML element, and without a hyphen in its name it can't be a custom element either, so the validator reports it as a completely unknown element and as a child that its parent doesn't allow. Removing name clears the warning but leaves both errors, and Vue then falls back to the default v- class prefix.
All three messages go away when Vue's template syntax stays out of the HTML the validator checks. With a build step, put the template in a single-file component (.vue). It is compiled ahead of time, so the template never reaches the page's HTML. Without one, move the template into a <script type="text/x-template"> element and point the app's template option at its id. The validator doesn't check markup inside a script element, and Vue compiles the template the same way.
Invalid example
<div id="app">
<transition name="slide">
<p v-if="saved">Changes saved</p>
</transition>
</div>
Valid example
<div id="app"></div>
<script type="text/x-template" id="app-template">
<transition name="slide">
<p v-if="saved">Changes saved</p>
</transition>
</script>
<script>
Vue.createApp({
template: "#app-template",
data() {
return { saved: true };
}
}).mount("#app");
</script>
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
1K Weekly
1,000 monthly checks. Cancel anytime.
Get 1K Weekly →Join teams across 40+ countries