Fix font-size inheritance in HTML artifact iframes
Set explicit font-size: 16px on the <html> element in sandboxed iframes to prevent browser default inheritance quirks that can cause unexpected font sizes (e.g., 75% shown in devtools). This establishes a consistent base font size while still allowing user HTML content to override it on body or specific elements as needed. Fixes the issue where HTML artifacts displayed with inconsistent font sizes due to iframe inheritance behavior.
This commit is contained in:
@@ -495,7 +495,12 @@ export class SandboxIframe extends LitElement {
|
||||
})
|
||||
.join("\n");
|
||||
|
||||
return `<script>
|
||||
return `<style>
|
||||
html {
|
||||
font-size: 16px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
window.sandboxId = ${JSON.stringify(sandboxId)};
|
||||
${dataInjection}
|
||||
${bridgeCode}
|
||||
|
||||
Reference in New Issue
Block a user