帮我生成一个好看简洁的手机提示html源码
以下是一个简洁的手机提示HTML源码示例:
<!DOCTYPE html>
<html>
<head>
<title>手机提示</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
margin: 0;
padding: 0;
}
.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;
}
h1 {
font-size: 24px;
margin-bottom: 20px;
}
p {
font-size: 18px;
margin-bottom: 20px;
}
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>
</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>
这个源码创建了一个容器,包含一个标题、一段文字和一个按钮。点击按钮可以检测当前手机的横竖屏状态,并弹出相应的提示信息
原文地址: https://www.cveoy.top/t/topic/ihwF 著作权归作者所有。请勿转载和采集!