# How to implement an iframe that shows previews of articles in the admin screen with the same design as the public site

- Link: https://zenn.dev/my_vision/articles/b6a59833ef2356
- Discussion: https://startupxo.com/en/1505/
- Posted by startupxo at 2026-12-02T00:54:56.642Z
- 0 points, 0 comments, kind story, origin curated
- Written in ko, machine translated to en

## Summary

- This is a method published by the development team of MyVision, a Japanese career transition support company. It solves the problem where, when previewing articles from sites with different designs per brand in the admin screen, the admin screen's CSS (design rules) gets applied and colors and other details end up off.
- The preview is placed inside an iframe, which is a separate document, and only the CSS of the relevant public site is loaded. React's createPortal renders the content inside the iframe, so the content being edited is passed through as is. The team says it did not modify the shared code that renders articles or the public sites.
- CSS is generated in advance for each site by Tailwind v4 when the admin screen is built. If the search base folder is not set to the relevant site, a different CSS is generated without any error, and old CSS may remain because of the Turborepo cache, so the input file must be specified.
- For sites that use next/font, the font settings are read from the source and turned into a separate CSS. Link clicks and form submissions inside the preview are blocked. If you change a site's CSS while the development server is running, it is not reflected automatically, so you need to restart the server or run a command.

## Sources

- Zenn: https://zenn.dev/my_vision/articles/b6a59833ef2356

## Comments (0)

No comments yet.

JSON: https://startupxo.com/api/v1/item.json?id=1505&lang=en
