在IntelliJ Idea中HTML格式化時,默認<head><body>以及<body>
下的標籤都不會縮進,這就致使你每次寫好html時候格式化的時候全部標籤都是同一層級沒有縮進,通常咱們寫html都會層級關係標籤嵌套,經過縮進看代碼結構就很清晰明朗,css
解決方案html
打開IDEA的設置editor->code style->HTML->other->Do not indent children of
刪掉<html><head><body>
這幾項就能夠了。web
<!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="stylesheet"> </head> <body> <div class="container"> <!-- Content here --> </div> </body> </html>
而後你在寫html時候就會有縮進bootstrap