我有一个带有图像的按钮,尽管图像正在拉伸(stretch)以适合按钮内部。我想阻止它这样做并将图像垂直和水平居中,但找不到这样做的方法,因为图像是使用 src 属性添加到按钮的。
<div id="form">
<input type="text" value="Name">
<input type="text" value="Email">
<textarea rows="7">Message</textarea>
<input id="button" type="image" src="Images/send_icon.png">
</div>
最佳答案
使用背景大小属性可能会解决您的问题。
background:url('imagepath') center no-repeat; background-size: 100% 100%;
关于html - CSS 按钮图像调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28578854/