手机端 等比例自适应
2021/12/27 23:09:04
本文主要是介绍手机端 等比例自适应,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>设计图为 320 / 568 比例</title>
<script src="./jQuery.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css">
body,
html {
padding: 0;
margin: 0;
}
#outer {
position: absolute;
left: 0;
overflow: hidden;
transform-origin: left top;
z-index: 999;
}
</style>
</head>
<body style="background-color: #000;">
<div id="outer">
<div style="padding: 10px;color:#fff;font-size:20px;;">
这是阿斯蒂芬阿斯顿发
<div style="margin-left:20px;">asdf asdf</div>
<div style="margin-left:40px;">asdf asdf</div>
<div style="margin-left:60px;">asdf asdf</div>
<div style="margin-left:80px;">asdf asdf</div>
<div style="margin-left:100px;">asdf asdf</div>
<div style="margin-left:120px;">asdf asdf</div>
<div style="margin-left:140px;">asdf asdf</div>
<div style="margin-left:160px;">asdf asdf</div>
<div style="margin-left:180px;">asdf asdf</div>
<div style="margin-left:200px;">asdf asdf</div>
<div style="margin-left:200px;">asdf asdf</div>
<div style="margin-left:180px;">asdf asdf</div>
<div style="margin-left:160px;">asdf asdf</div>
<div style="margin-left:140px;">asdf asdf</div>
<div style="margin-left:120px;">asdf asdf</div>
<div style="margin-left:100px;">asdf asdf</div>
<div style="margin-left:80px;">asdf asdf</div>
<div style="margin-left:60px;">asdf asdf</div>
<div style="margin-left:40px;">asdf asdf</div>
<div style="margin-left:20px;">asdf asdf</div>
这是阿斯蒂芬阿斯顿发
</div>
</div>
<script type="text/javascript">
const screenWidth = window.screen.width;
const screenHeight = window.screen.height;
$("#outer").css({
'transform': 'scale(' + (screenWidth / 320) + ')'
})
</script>
</body>
</html>
这篇关于手机端 等比例自适应的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-27消息中间件底层原理资料详解
- 2024-11-27RocketMQ底层原理资料详解:新手入门教程
- 2024-11-27MQ底层原理资料详解:新手入门教程
- 2024-11-27MQ项目开发资料入门教程
- 2024-11-27RocketMQ源码资料详解:新手入门教程
- 2024-11-27本地多文件上传简易教程
- 2024-11-26消息中间件源码剖析教程
- 2024-11-26JAVA语音识别项目资料的收集与应用
- 2024-11-26Java语音识别项目资料:入门级教程与实战指南
- 2024-11-26SpringAI:Java 开发的智能新利器