Css 一个背景图像未显示,而另一个背景图像未显示
我在同一个目录中有两个图像。当我尝试使用css将其中一个用作背景图像时,它不会显示,但当我使用另一个时,它会显示。这到底是怎么回事 这里是我的css代码,仅供参考 这个不行Css 一个背景图像未显示,而另一个背景图像未显示,css,Css,我在同一个目录中有两个图像。当我尝试使用css将其中一个用作背景图像时,它不会显示,但当我使用另一个时,它会显示。这到底是怎么回事 这里是我的css代码,仅供参考 这个不行 a:hover { background-image: url("images/menu-ident.png"); background-size: 110px; background-repeat: no-repeat; background-color: transparent;
a:hover {
background-image: url("images/menu-ident.png");
background-size: 110px;
background-repeat: no-repeat;
background-color: transparent;
background-position: bottom center;
color: rgba(255, 255, 255, 1);
}
这个确实管用
a:hover {
background-image: url("images/logo.png");
background-size: 110px;
background-repeat: no-repeat;
background-color: transparent;
background-position: bottom center;
color: rgba(255, 255, 255, 1);
}
当然,这不起作用-第二个覆盖第一个(选择相同的元素)。如果希望在同一元素上有多个背景图像,请查看此处: 如果两个不同元素需要两个不同的背景,则需要不同的css选择器,如类或ID:
a.bg-1:hover {
background-image: url("images/menu-ident.png");
background-size: 110px;
background-repeat: no-repeat;
background-color: transparent;
background-position: bottom center;
color: rgba(255, 255, 255, 1);
}
a.bg-2:hover {
background-image: url("images/logo.png");
background-size: 110px;
background-repeat: no-repeat;
background-color: transparent;
background-position: bottom center;
color: rgba(255, 255, 255, 1);
}检查以下内容:它们是否在同一文件夹中?名字上有拼写错误吗?分机对吗?如果是,请尝试重命名图像或使用单引号。能否提供图像折叠的屏幕截图当然,这不起作用-第二个覆盖第一个(选择相同的元素)。如果想在同一个元素上使用多个背景图像,请看这里:我没有重复我显示的代码,除了背景图像,所有代码都是相同的。
a.bg-1:hover {
background-image: url("images/menu-ident.png");
background-size: 110px;
background-repeat: no-repeat;
background-color: transparent;
background-position: bottom center;
color: rgba(255, 255, 255, 1);
}
a.bg-2:hover {
background-image: url("images/logo.png");
background-size: 110px;
background-repeat: no-repeat;
background-color: transparent;
background-position: bottom center;
color: rgba(255, 255, 255, 1);