我找到了一种方法来制作我自己的自定义文件上传控件,方法是在它上面放置一个假控件,当我点击假控件时,我实际上是在点击下面的真实控件。
无论如何,浏览按钮的图像有点靠上。
我怎样才能把它降低一点?
这是 js fiddle 。
这是 html 和 css:
<div>
<div class="fileinputs">
<input type="file" class="file" />
<div class="fakefile">
<input />
<img src="search.jpg" />
</div>
</div>
</div>
div.fileinputs {
position: relative;
}
div.fakefile {
position: absolute;
top: 0px;
left: 0px;
z-index: 1;
}
input.file {
position: relative;
text-align: right;
-moz-opacity:0;
filter:alpha(opacity: 0);
opacity: 0;
z-index: 2;
}
最佳答案
我相信这就是您要找的。 jsFiddle
CSS
.moveimage
{
position: relative;
top: 3px;
}
修改后的 HTML
<img class="moveimage" src="search.jpg" />
关于html - 如何在 html 页面中将 img src 向下移动几个像素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24923919/