javascript - 是否可以在边框上添加图像?
问题描述
我希望你一切都好。我想在边框上添加图像。考虑一个 100px 实心的边框。我只想将图像放在边框上是否可以使用 CSS。就像我使用位置一样,z-index 但看不到效果。你可以看到代码。我只想在边框上显示图像而不是在边框上。示例https://i.imgur.com/1IA2Ddj.jpg
<img width="30%" height="30%" src="https://i.imgur.com/deoFQ7i.png" />
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; max-width: 600px !important; border-left: 62px solid #fca9cf;">
<tr class="container" style="">
<td valign="top" style="background-image: url('https://i.imgur.com/deoFQ7i.png'); background-repeat: no-repeat; background-position: -20px; background-size: contain; border-top: 0; border-bottom: 0; padding-top: 0; padding-bottom: 0;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width: 100%; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;">
<tbody class="mcnTextBlockOuter">
<tr>
<td valign="top" class="mcnTextBlockInner" style="padding-top: 0px; mso-line-height-rule: exactly; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;">
<table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width: 100%; min-width: 100%; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" width="100%"
class="mcnTextContentContainer">
<tbody>
<tr>
<td valign="top" class="mcnTextContent" style="padding: 0px 18px 9px; line-height: 200%; mso-line-height-rule: exactly; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; color: #603813; font-family: Helvetica; font-size: 16px; text-align: left;">
<p style=" font-family: philosopher;color: #603813;font-size: 24px;text-align: center;line-height: 200%;margin: 10px 0;padding: 0;mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%;">
<br />
<br />
</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
解决方案
解决方案1:
.rectangle {
background:pink;
width:100px;height:150px;
position:relative;
}
img {
width:100px;position:absolute;
right:-86px;
}
<div class="rectangle">
<img src="https://i.imgur.com/deoFQ7i.png">
</div>
推荐阅读
- python - 请问我在这里缺少什么语法
- elasticsearch - 返回匹配多个通配符字符串查询的文档
- coldfusion - 在指向结构中的值时做错了
- c - 在编译时打印静态分配的数组内容
- c# - 统一。如何使玩家转向运动方向
- terraform - 为什么我的 AWS ACM 证书无法验证?
- alphanumeric - 从字母数字数据映射和排序
- c - 如何解决这些错误和警告?还有一些来自这个程序的问题
- azureservicebus - 使用 Azure 服务总线主题时从 _error 队列中移动消息
- flutter - imagepicker 不会让我在 android 上运行我的应用程序,在 IOS 上它工作正常