【发布时间】:2020-05-31 07:10:37
【问题描述】:
我有一个带有背景图像和大于图像宽度的文本的按钮。 怎么把图片放在文字中间
<!DOCTYPE html>
<html>
<head>
<style>
.button {
background: url('http://127.0.0.1/pics/item/c1763.png') no-repeat;
background-size: 100% 100%;
border: none;
color: black;
font-size: 16px;
width:60px;
height:60px;
padding-top:60px;
white-space: nowrap;
background-position: center center;
display: flex;
}
</style>
</head>
<body>
<button class="button">Button text test</button>
</body>
</html>
【问题讨论】:
-
尝试背景尺寸:包含
-
感谢您的回复,但对图像对齐没有任何影响
标签: css image button alignment