加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 rpgmz 于 2025-5-30 14:20 编辑
设置一个壁纸就不会有黑边了 壁纸的话可以自定义 在PC端 Android端 浏览器 都是可以正常使用
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="user-scalable=no">
<link rel="icon" href="icon/icon.png" type="image/png">
<link rel="apple-touch-icon" href="icon/icon.png">
<link rel="stylesheet" type="text/css" href="css/game.css">
<title>勇者传说</title>
<style>
body {
/* 移除默认边距 */
margin: 0;
/* 设置背景图片(需替换为你的图片路径) */
background-image: url('img/titles1/back1.png');
/* 背景图片全屏覆盖 */
background-size: cover;
/* 背景图片不重复 */
background-repeat: no-repeat;
/* 背景图片固定,不随滚动移动 */
background-attachment: fixed;
/* 背景颜色(可选,用于图片加载失败时的 fallback) */
background-color: #000;
}
</style>
</head>
<body>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="user-scalable=no">
<link rel="icon" href="icon/icon.png" type="image/png">
<link rel="apple-touch-icon" href="icon/icon.png">
<link rel="stylesheet" type="text/css" href="css/game.css">
<title>勇者传说</title>
<style>
body {
/* 移除默认边距 */
margin: 0;
/* 设置背景图片(需替换为你的图片路径) */
background-image: url('img/titles1/back1.png');
/* 背景图片全屏覆盖 */
background-size: cover;
/* 背景图片不重复 */
background-repeat: no-repeat;
/* 背景图片固定,不随滚动移动 */
background-attachment: fixed;
/* 背景颜色(可选,用于图片加载失败时的 fallback) */
background-color: #000;
}
</style>
</head>
<body>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
核心代码如下
<style>
body {
/* 移除默认边距 */
margin: 0;
/* 设置背景图片(需替换为你的图片路径) */
background-image: url('img/titles1/back1.png');
/* 背景图片全屏覆盖 */
background-size: cover;
/* 背景图片不重复 */
background-repeat: no-repeat;
/* 背景图片固定,不随滚动移动 */
background-attachment: fixed;
/* 背景颜色(可选,用于图片加载失败时的 fallback) */
background-color: #000;
}
</style>
<style>
body {
/* 移除默认边距 */
margin: 0;
/* 设置背景图片(需替换为你的图片路径) */
background-image: url('img/titles1/back1.png');
/* 背景图片全屏覆盖 */
background-size: cover;
/* 背景图片不重复 */
background-repeat: no-repeat;
/* 背景图片固定,不随滚动移动 */
background-attachment: fixed;
/* 背景颜色(可选,用于图片加载失败时的 fallback) */
background-color: #000;
}
</style>
需要修改index.html文件
图片分别展示了 PC 浏览器 Android 壁纸全部可以拉伸全屏 不在有黑边
|