2017-04-26 101 views
0

嗨如何播放百里香背景音乐?基本方式失去百里香背景音乐

<audio controls> 
    <source src="/static/hikariare.mp3" type="audio/mpeg"> 
</audio> 

我得到这样的:

org.xml.sax.SAXParseException: Attribute name "controls" associated with an element type "audio" must be followed by the ' = ' character. 

回答

0

对于XHTML,你必须将它们设置这样那样的大多数属性(必填,控制等)。 (您可能会不得不结束源标记为好。)

<audio controls="controls"> 
    <source src="/static/hikariare.mp3" type="audio/mpeg"></source> 
</audio> 
+0

哦感谢的人,你让我很快乐 – Shinzoo

0

如果你使用Spring的引导和spring-boot-starter-thymeleaf依赖,你应该添加

<properties> 
    <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version> 
    <thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version> 
</properties> 

pom.xml

这力量行家使用Thymeleaf 3.默认Thymeleaf 2仅支持HTML/XHMTL,而不是纯粹的HTML5(<audio controls>是HTML5)这里

更多信息:https://docs.spring.io/spring-boot/docs/current/reference/html/howto-spring-mvc.html#howto-use-thymeleaf-3