百里香的背景音乐

时间:2017-04-26 14:17:36

标签: html5 thymeleaf

你好我怎么能在百里香中演奏背景音乐?失败的基本方式

Dove

我得到这样的东西:

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

2 个答案:

答案 0 :(得分:0)

对于XHTML中的大多数属性(必需,控件等),您必须像这样设置它们。 (您可能还必须结束源标记。)

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

答案 1 :(得分:0)

如果使用Spring-Boot和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

这迫使maven使用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