fix: 预览里 normalize.css 盖掉了学生自己写的样式
normalize 放在学生的 <style> 后面,同样写法的规则后加载的赢,学生写的 body { margin: 20px }、
h1 { margin: 0 } 等都不生效(实测 body 边距始终是 0)。挪到学生样式前面。
挑战预览、批改、作品展、提示词链、下载的文件都走 buildPreviewDocument,一起修好。
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f0dd33de3
commit
54003fd404
1 file changed
+2
-1
@@ -30,8 +30,9 @@ export function buildPreviewDocument({
|
|||||||
<title>预览</title>
|
<title>预览</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
${assetBaseUrl ? `<base href="${assetBaseUrl}">` : ""}
|
${assetBaseUrl ? `<base href="${assetBaseUrl}">` : ""}
|
||||||
<style>${css}</style>
|
<!-- normalize 要在学生的样式前面,否则同样写法的规则(body、h1 的边距等)会被它盖掉 -->
|
||||||
<link rel="stylesheet" href="/normalize.min.css" />
|
<link rel="stylesheet" href="/normalize.min.css" />
|
||||||
|
<style>${css}</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
${html}
|
${html}
|
||||||
|
|||||||
Reference in new issue
Block a user