gpt4 book ai didi

html - 如何在@media 屏幕属性中调整图像大小?

转载 作者:行者123 更新时间:2023-11-28 10:33:41 24 4
gpt4 key购买 nike

我想知道如何在@media screen 和 max-width:640 中调整图像的大小。我的样式.css:

#header-wrapper
{
position: relative;
padding: 7em 0 0;
background:url(images/fox-illustration.jpg) no-repeat center;
background-position:center;
width:auto;
height:768px;

}

我的 mobile.css:

@media screen and (max-width: 640px) {

header-wrapper {
width: 600px;
}

所以宽度仅适用于 header 包装器..我还尝试给 mobile.css 中的 header-wrapper 另一个图像(我在 photoshop 中将其调整为手机大小)。

但这也不起作用。我想是因为 header-wrapper 的图像在 style.css 中覆盖了它?

最佳答案

background:url(images/fox-illustration.jpg);
background-size:600px 400px;
background-repeat:no-repeat;

这样做

关于html - 如何在@media 屏幕属性中调整图像大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23426056/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com