網頁顯示實際寬度

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
<title>設備信息</title>
<style>
<?php
$ppi = 96;
if(strpos($_SERVER['HTTP_USER_AGENT'],' MI 5 Build') !== FALSE){
	$ppi = 428;
}
?>
body{font-size:16px;}
span{display:inline-block;min-height:20px;background-color:#000000;}
</style>
<script>
var ppi = <?php echo $ppi;?>;
var rem = ppi/2.54/window.devicePixelRatio;
//rem模擬釐米
document.documentElement.style.fontSize = rem + 'px';
</script>
</head>
<body>
<?php
echo '通訊協議: ' . $_SERVER['SERVER_PROTOCOL'] ."<br/>\n";
echo '請求方法: ' . $_SERVER['REQUEST_METHOD'] ."<br/>\n";
echo 'User-Agent: ' . $_SERVER['HTTP_USER_AGENT'] ."<br/>\n";
echo '用戶IP: ' . $_SERVER['REMOTE_ADDR'] ."<br/>\n";
?>
<br/>
<script>
window.document.write('像素比例: ' + window.devicePixelRatio + '<br/>\n');
window.document.write('色彩深度: ' + window.screen.pixelDepth + '<br/>\n');
window.document.write('屏幕寬度: ' + window.screen.width + '<br/>\n');
window.document.write('屏幕高度: ' + window.screen.height + '<br/>\n');
window.document.write('屏幕可用寬度: ' + window.screen.availWidth + '<br/>\n');
window.document.write('屏幕可用高度: ' + window.screen.availHeight + '<br/>\n');
if (window.screen.deviceXDPI != undefined) {
	window.document.write('屏幕水平DPI: ' + window.screen.deviceXDPI + '<br/>\n');
	window.document.write('屏幕垂直DPI: ' + window.screen.deviceYDPI + '<br/>\n');
}
window.document.write('<br/>\n');
window.document.write('窗口寬度: ' + window.outerWidth + '<br/>\n');
window.document.write('窗口高度: ' + window.outerHeight + '<br/>\n');
window.document.write('窗內寬度: ' + window.innerWidth + '<br/>\n');
window.document.write('窗內高度: ' + window.innerHeight + '<br/>\n');
</script>

<br>
<span style="width:100px;"></span> 100px<br>
<span style="width:96px;"></span> 96px<br><br>

<span style="width:1rem;"></span> 1cm<br>
<span style="width:2rem;"></span> 2cm<br>
<span style="width:5rem;"></span> 5cm<br>

<span style="width:2.54rem;"></span> 1in,1in=2.54cm<br>
<span style="width:5.08rem;"></span> 2in,=5.08cm<br>
<span style="width:2.54rem;"></span> 72pt,=1in<br>
<span style="width:3.5277777777778rem;"></span> 100pt<br>
<span style="width:2.54rem;"></span> 6pc,=1in<br>
<span style="width:4.2333333333333rem;"></span> 10pc<br><br>

<span style="width:2.46rem;"></span> 1寸=2.46cm<br><br>
ID-1尺寸<br>85.60 × 53.98毫米 、<br>3.370 × 2.125英寸 、<br>242.64 × 153磅<br>
<span style="width:5.398rem;height:8.560rem;"></span><br>

直尺釐米<br>
<style>
.mm{display:block;margin:0;padding:0;height:0.1rem;width:0.3rem;min-height:1px;margin-left:0.1rem;}
.mm0{margin-left:0px;}
.mm10{margin-left:0px;background-color:#ff0000;}
</style>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm0"></span>
<span class="mm"></span>
<span class="mm mm10"></span>
</body>
</html>
相關文章
相關標籤/搜索