我尝试在2个图像之间切换500像素宽和1000像素,这取决于视窗宽度,但无论如何都会得到一个小图像
<html>
<head>
<meta charset="utf-8">
<title> tryings </title>
</head>
<body>
<img srcset="abstract-500w.jpg 500w, abstract-1000w.jpg 1000w"
sizes="(max-width: 600px) 500px,
(min-width: 601px) 1000px,
1000px"
alt="an abstract picture"
width="500" height="333">
</body>
</html>似乎我做的一切都像教程一样,找不到问题所在
发布于 2020-08-23 03:03:30
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<title> tryings </title>
</head>
<body>
<style>
/* For width smaller than 400px: */
body {
/* background-color: red; */
background-image: url('image1.png');
background-repeat: no-repeat;
}
/* For width 400px and larger: */
@media only screen and (min-width: 400px) {
body {
/* background-color: blue; */
background-image: url('secondimg.jpg');
background-repeat: no-repeat;
}
}
</style>
</body>
</html>https://stackoverflow.com/questions/63539525
复制相似问题