diff --git a/changelog_unreleased/html/pr-7916.md b/changelog_unreleased/html/pr-7916.md
new file mode 100644
index 000000000000..8028e4508e9b
--- /dev/null
+++ b/changelog_unreleased/html/pr-7916.md
@@ -0,0 +1,34 @@
+#### Format `script` and `style` content inside HTML tag with colon ([#7916](https://github.com/prettier/prettier/pull/7916) by [@fisker](https://github.com/fisker))
+
+
+```html
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
diff --git a/src/language-html/utils.js b/src/language-html/utils.js
index 978c69785b45..94dd4434e8ba 100644
--- a/src/language-html/utils.js
+++ b/src/language-html/utils.js
@@ -135,7 +135,9 @@ function isScriptLikeTag(node) {
node.type === "element" &&
(node.fullName === "script" ||
node.fullName === "style" ||
- node.fullName === "svg:style")
+ node.fullName === "svg:style" ||
+ (isUnknownNamespace(node) &&
+ (node.name === "script" || node.fullName === "style")))
);
}
diff --git a/tests/html_basics/__snapshots__/jsfmt.spec.js.snap b/tests/html_basics/__snapshots__/jsfmt.spec.js.snap
index 83fd2e1cbb1b..deecf6caef0a 100644
--- a/tests/html_basics/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/html_basics/__snapshots__/jsfmt.spec.js.snap
@@ -623,6 +623,21 @@ e-wrap
+
+
+
+
+
+const func = function() { console.log('Hello, there');}
+.a{color:#f00}
+
+
+
+const func = function() { console.log('Hello, there');}
+.a{color:#f00}
+
=====================================output=====================================
@@ -832,9 +847,52 @@ e-wrap
+
+
+
+
+
+ const func = function() { console.log('Hello, there');}
+ .a{color:#f00}
+
+
+
+const func = function() { console.log('Hello, there');}
+.a{color:#f00}
+
================================================================================
`;
diff --git a/tests/html_basics/with-colon.html b/tests/html_basics/with-colon.html
index aad6b41583cb..29ca0989dc95 100644
--- a/tests/html_basics/with-colon.html
+++ b/tests/html_basics/with-colon.html
@@ -110,3 +110,18 @@
const func = function() { console.log('Hello, there');}
+
+
+
+
+
+
+const func = function() { console.log('Hello, there');}
+.a{color:#f00}
+
+
+
+const func = function() { console.log('Hello, there');}
+.a{color:#f00}