html - 如何制作带有图像的按钮。(如 facebook)
问题描述
我有水平宽按钮。
现在我想把透明png放在它的右边缘。
可能吗??
例如,这个按钮看起来在蓝色按钮的左边缘有一个“f”标记。
<button type="button" id="sendBy"
class="btn mx-auto"
style="background-color:rgba(43,162,42,1);
color:white;
margin:0px;padding:0px;font-size:0.8rem;width:90%;
height:40px;border-radius:8px;">
send</button>
解决方案
有很多方法,但我喜欢inline-flex
在我button
的两个孩子身上使用,因为 flex 提供了许多好的属性:
button {
background-color: rgba(43, 162, 42, 1);
color: white;
margin: 0px;
padding: 0 1rem;
font-size: 0.8rem;
width: 90%;
height: 40px;
border-radius: 8px;
display: inline-flex;
align-items: center;
}
.col-text {
flex-grow: 1;
}
<button type="button" id="sendBy" class="btn mx-auto">
<span class="col-text">send</span>
<span>icon</span>
</button>
推荐阅读
- php - PHP; 时间转换形式距离和速度
- structure - 如何将结构从合同 A 传递给合同 B?最佳实践
- php - 无法在 PHP 中下载 pdf
- javascript - 三向按钮切换
- c# - 自定义 Nuget 包显示缺少依赖项错误
- ruby-on-rails - Rails:配置应用程序
- makefile - makefile 中 Match-Anything 模式规则的行为
- java - 如何使用 SimpleJpaRepository 中的方法检查数据库中是否存在实体
- docker - 基于控制台的 dockerized kafka 消费者
- python - 请求无效。详细信息:参数:无效的 JSON。JSON 内容中无法识别令牌