# Attribute “xmlns:style” not allowed here.

> Canonical HTML version: https://rocketvalidator.com/html-validation/attribute-xmlns-style-not-allowed-here
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `xmlns:style` attribute declares an XML namespace prefix, and HTML elements don't accept namespace declarations other than `xmlns` itself.

In XML, `xmlns:style="..."` binds the prefix `style` to a namespace URI, so the document can use names like `style:font`. The HTML parser doesn't process namespace declarations. It reads `xmlns:style` as an ordinary attribute with an unusual name and does nothing with it. The one namespace attribute an HTML element may have is `xmlns`, and only with the exact value `http://www.w3.org/1999/xhtml`. The validator rejects prefixed declarations like `xmlns:style` on every HTML element, `<html>` included.

The attribute usually comes from markup generated with XML tools. An XSLT stylesheet, for example, copies the namespace declarations in scope onto each literal element it outputs, unless the prefix is listed in `exclude-result-prefixes`:

```xml
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:style="http://www.w3.org/1999/xhtml"
  exclude-result-prefixes="style">
```

When a template repeats the declaration on the same element, the validator also reports a duplicate attribute error. Removing `xmlns:style` fixes both, and the page renders the same because the attribute has no effect in browsers.

## Invalid example

```html
<div class="top-bar" xmlns:style="http://www.w3.org/1999/xhtml">
  <a href="/">Home</a>
</div>
```

## Valid example

```html
<div class="top-bar">
  <a href="/">Home</a>
</div>
```
