简体   繁体   English

以不同的缩放级别或屏幕尺寸渲染元素

[英]Rendering an element in a different zoom level or screen size

I'm creating a (react) component library for documentation and testing purposes for our company. 我正在创建一个(反应)组件库,用于为我们公司进行文档编制和测试。 A kind of style guide. 一种样式指南。 Some of our components have styles that depend on media queries to scale up and down nicely. 我们的某些组件的样式依赖于媒体查询来很好地缩放。

Our style guide site is responsive but I would like to be able to render different screen sizes. 我们的风格指南网站响应迅速,但我希望能够呈现不同的屏幕尺寸。 As an example, I wanted to show how the site header looks like in desktop and mobile without having to resize the window , as if they were multiple iframes with different zoom levels. 举例来说,我想展示网站标题在台式机移动设备中的外观, 无需调整窗口大小 ,就好像它们是具有不同缩放级别的多个iframe一样。

So I was thinking if it was somehow possible to make html elements think they are being rendered in a larger or smaller screen by changing their zoom level. 所以我在想是否有可能通过更改其缩放级别使html元素认为它们是在更大或更小的屏幕中呈现的。 A sort of scaling, while staying within the same limits. 一种缩放,同时保持在相同范围内。

In google chrome there is a tool who do this. 在谷歌浏览器中,有一个工具可以做到这一点。

Right Click > Inspect the element > The mobile icon at the top corner right

Check my screenshot below. 在下面查看我的屏幕截图。

响应工具

Cheers mate ;) 队友的欢呼声 ;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM