I use Magento 2.2 and it doesnt work for me either (dev mode), This is probably a bug. As a patch until this is fixed you can edit:
magento/framework/View/Layout/etc/layout_merged.xsd
Add under root element (you'll see that the other schema tags of head/body/elements are also there):
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="urn:magento:framework:View/Layout/etc/elements.xsd"/>
<xs:include schemaLocation="urn:magento:framework:View/Layout/etc/head.xsd"/>
<xs:include schemaLocation="urn:magento:framework:View/Layout/etc/body.xsd"/>
<!--ADD THE NEXT LINE-->
<xs:include schemaLocation="urn:magento:framework:View/Layout/etc/html.xsd"/>
Then you should add under xs:complexType tag with name="layoutType" (around line 33) under 'xs:choice' tag >> the element tag for that html schema (htmlType):
<xs:complexType name="layoutType">
<xs:annotation>
<xs:documentation>
Layout Type definition
</xs:documentation>
</xs:annotation>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="referenceContainer" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="container" type="containerType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="update" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="remove" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="move" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="block" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="referenceBlock" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="body" type="bodyType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="head" type="headType" minOccurs="0" maxOccurs="unbounded"/>
<!--ADD THE NEXT LINE-->
<xs:element name="html" type="htmlType" minOccurs="0" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
Then it should work by adding the the proper xml in any xml layout file, e.g.:
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<html>
<attribute name="class" value="page-with-filter" />
</html>
</page>
<html>
and the only method I could find is to hardcode it inroot.phtml
. But it looks like we should be able to do it with layout XML. Unless this was added to the template but the functionality was never added. – Ben Crook Nov 13 '17 at 14:42