<!DOCTYPE html>
<html>
<head>
<title>手机横屏提示</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
margin: 0;
padding: 0;
}
<p>.container {
width: 300px;
margin: 50px auto;
background-color: #fff;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
padding: 20px;
text-align: center;
}</p>
<p>h1 {
font-size: 24px;
margin-bottom: 20px;
}</p>
<p>p {
font-size: 18px;
margin-bottom: 20px;
}</p>
<p>button {
background-color: #4CAF50;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
}
</style></p>
</head>
<body>
<div class="container">
<h1>手机横屏提示</h1>
<p>请将手机横屏以获得更好的浏览体验。</p>
<button onclick="rotate()">旋转</button>
</div>
<script>
function rotate() {
if (window.innerWidth > window.innerHeight) {
alert("感谢您已将手机横屏!");
} else {
alert("请将手机横屏以获得更好的浏览体验!");
}
}
</script>
</body>
</html>
简洁手机横屏提示HTML源码

原文地址: https://www.cveoy.top/t/topic/pZLl 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录