使用PHP在网站内进行分辨率模拟

问题描述:

I have pretty strange question. Is there any way to simulate resolution in PHP/javascript? Lets say, my current resolution of screen is 1280x800. I have a container which is 50% width of web page, within it, I would like to be able to see, how something looks like in diferent resolution, lets say, on 1600x900 laptop screen. It should be shown only within that container. Is it possible? how it can be accomplished?

我有一个非常奇怪的问题。 有没有办法在PHP / javascript中模拟分辨率? 可以说,我目前的屏幕分辨率是1280x800。 我有一个50%宽度的网页容器,在其中,我希望能够看到,在1600x900笔记本电脑屏幕上,不同分辨率的东西看起来如何。 它应该只在该容器内显示。 可能吗? 如何实现? p> div>

You could use css zoom

Css

.r100_50 {
  width: 100px;
  height: 50px;
  background-color: #A00;
}

Html

<div class="r100_50">
  This is 100 x 50
</div>
<div class="r100_50" style="zoom: 0.25">
  This is 100 x 50 x 0.25
</div>
<div class="r100_50" style="zoom: 2">
  This is 100 x 50 x 2
</div>

jsFiddle (zoom)

EDIT: Another (better) way is to use css transformation, scale as pointed out by Justinas.

jsFiddle (transform)