例如:
border使用dashed, 里面加是一个iconfont
例如:
<div class="upload-btn">
<i iconfont="plus" />
</div>
css:
.upload-btn {
width: 200px;
height: 200px;
display: flex;
align-items: center;
justify-content: center;
border: 1px dashed #eee;
}
SVG的方式:
<style>
.upload-btn {
display: flex;
align-items: center;
justify-content: center;
width: 200px;
height: 200px;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="%23ccc" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><path d="M12 1v22M1 11h22"/></svg>');
background-repeat: no-repeat;
background-position: center;
border: 1px dashed #ccc;
}
</style>
<div class="upload-btn"></div>
2 回答858 阅读✓ 已解决
4 回答949 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
2 回答1k 阅读✓ 已解决
2 回答2.6k 阅读
1 回答1k 阅读✓ 已解决
2 回答875 阅读✓ 已解决
用CSS线性渐变可以实现
可以自己改大小和颜色
https://codepen.io/xboxyan/pen/OJBvbNo