2017-04-26 234 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