gpt4 book ai didi

html - 图标网格中的缩放图标

转载 作者:太空宇宙 更新时间:2023-11-03 18:04:12 25 4
gpt4 key购买 nike

我在一个网站上工作,我有一个图标网格,其中每一行都有一个不同的图标,每一列都有不同的阴影。图标网格存储在 .png 中。格式,像这样:

enter image description here

要访问特定图标,我的 CSS 和 html 中有以下内容:<i class="icon type1 blue>...</i>这工作得很好,但问题是我需要让图标小一点,所以我把我的 png 缩小了 75%。但现在的问题是它显示了相同的图标,但它显示了一半的蓝色图标和一半的灰色图标,如下所示:enter image description here

如何在 75% 的比例下只显示蓝色图标?这是图像(设置为全尺寸)的 CSS 代码:

.icon{
background-image: url('images/icons.png');
background-repeat: no-repeat;
width: 28px;
heigh: 28px;
display: block;
font-style: normal;
}

最佳答案

你可以试试

background: url(images/yourimage.jpg) no-repeat center center fixed;

参见:Stretch background image css?

或者你也可以在 css3 中尝试 background-size: 100%;

关于html - 图标网格中的缩放图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24961528/

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