gpt4 book ai didi

html - 将 svg 居中对齐到具有灰色背景的按钮

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

我有一个带有图像的按钮,我想将其对齐到中心。我希望按钮具有灰色背景。

HTML:

 <button type="submit" data-target="#modal">
<img className="rainbow" role="presentation" />
</button>

CSS:

.rainbow {
background: url("/static/icons/arrow.svg") no- repeat center;
border: none;
cursor:pointer;
overflow: hidden;
outline:none;
height: 53px;
width: 50px;
background-color: $welcome-gray-1;
}

final_image_button

icon_center_aligned

最佳答案

您不需要内联图像,您需要将背景应用到按钮元素。

button {
background: #000 url("/static/icons/arrow.svg") no-repeat center;
border: none;
cursor: pointer;
overflow: hidden;
outline: none;
height: 53px;
width: 50px;
}
<button type="submit" data-target="#modal" />

关于html - 将 svg 居中对齐到具有灰色背景的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54839675/

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