hzyhx

之前我们引入css和js样式是这样的

1 <!--bootstrap的css样式-->
2 <link href="css/bootstrap.min.css" rel="stylesheet" >
3 <!--jquery ui的js样式-->
4 <script src="jquery-ui-1.12.1/jquery-ui.min.js" ></script>

而String工程里引入css和js,只需要在前面加一个th:

引入css在href前面加th:

引入js在src前面加th:

示例

1 <!--bootstrap的css样式-->
2 <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"    type="text/css" />
3 
4 <!-bootstrap的js样式--->
5 <script type="text/javascript" th:src="@{/js/bootstrap.bundle.min.js}"></script>

注意:在视图中css样式放在</head>结束标签前面

          js样式放在</body>结束标签前面

 

css和js放在工程的哪个目录下?

答:放在工程的src/main/resources/static目录下

分类:

技术点:

相关文章:

  • 2021-12-31
  • 2022-12-23
  • 2022-02-08
  • 2021-12-05
  • 2021-12-30
  • 2022-01-06
猜你喜欢
  • 2022-01-05
  • 2021-12-05
  • 2021-10-03
  • 2021-09-22
  • 2021-12-09
  • 2021-06-25
  • 2021-12-09
相关资源
相似解决方案