gpt4 book ai didi

css - HTML 图形中的额外填充

转载 作者:太空宇宙 更新时间:2023-11-04 14:05:52 26 4
gpt4 key购买 nike

我正在尝试使用各种自定义复选框输入,但我不太确定所有这些填充的来源......

这个想法是显示一个图像来代替带有文本的复选框,当它被选中时,图像的不透明度会降低以在其下方显示一个符号,表明它已被选中。

我用这个 fiddle 把它归结为: http://jsfiddle.net/tx76J/1/

<li>
<input id="1" type="checkbox">
<label for="1">
<figure>
<img src="http://www.moderndandies.com/files/images/Asus-smartphone-android.jpg">
</figure>
</label>
</li>​

enter image description here

最佳答案

  • list-style: none; 添加到您的 li 中。问题是由列表标记引起的,如果您删除黑色背景颜色就可以看到它(我确定它仅用于演示,但对于 future 的访问者:li 应该始终存在仅在 olul 中)。

    enter image description here

  • 此外,将img 设置为display: block 以去除底部的空间。这是因为默认情况下图像被认为是内联的(也在这个问题中解释:White space at bottom of anchor tag SO)。

jsFiddle Demo that shows it working

关于css - HTML 图形中的额外填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11398686/

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