【发布时间】:2021-02-01 01:36:17
【问题描述】:
我的 css 样式表中有以下规则:
body {
background: url('../Pic/poly-parallax Half.png') fixed center no-repeat;
background-color: rgb(231,231,231);
width: 100%;
background-size: contain;
background-position: left;
}
.logo {
height: 275px;
background: url('Pic/Logo.png') fixed center no-repeat;
background-size: 275px 70px;
background-position: top right;
}
虽然我将其定义为固定的,但徽标图像仍保持响应。
这是 HTML 代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="BSC1.css">
<title></title>
</head>
<body>
<div class="logo">
</div>
</body>
</html>
例子:
【问题讨论】:
-
我没有看到它有响应,我在 jsfiddle 中尝试过。您如何看待响应式响应?
-
在固定身体图像时缩放 +/- 调整徽标大小
-
jsfiddle.net/2ukt6z7w 调整大小时我没有看到图像有任何变化。
-
我使用 Visual Studio 编码
-
我也是,但我链接了您的代码示例,以便您可以看到我看到的内容。
标签: html css responsive-design background-image background-position