1. 程式人生 > 程式設計 >解決IDEA中編輯HTML格式檔案不自動縮排問題

解決IDEA中編輯HTML格式檔案不自動縮排問題

在IntelliJ Idea中HTML格式化時,預設<head><body>以及<body>下的標籤都不會縮排,這就導致你每次寫好html時候格式化的時候所有標籤都是同一層級沒有縮排,一般我們寫html都會層級關係標籤巢狀,通過縮排看程式碼結構就很清晰明朗,

解決方案

開啟IDEA的設定 editor->code style->HTML->other->Do not indent children of

刪掉<html><head><body>這幾項就可以了。

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 <head>
  <meta charset="UTF-8">
  <title>websocket聊天室</title>
  <link th:href="@{/webjars/bootstrap/4.4.1/css/bootstrap.min.css}" rel="external nofollow" rel="stylesheet">
 </head>
 <body>
  <div class="container">
   <!-- Content here -->

  </div>
 </body>
</html>

然後你在寫html時候就會有縮排

總結

以上所述是小編給大家介紹的解決IDEA中編輯HTML格式檔案不自動縮排問題,希望對大家有所幫助!