html - 如何用css改变单词的形状?
问题描述
我想把一个单词的形状变成菱形。使用一个元素,我可以通过使用tranform rotate
90 度然后调整宽度来做到这一点。但是我该怎么做呢?
.contact {
height: 50px;
width: 100px;
color: red;
border-radius: 50px/100px;
border:1px solid;
}
<div class="contact">contact
</div>
没用,所以我尝试使用shape-outside
:
.contact{height: 50px;
width: 100px; color: red;
border-radius: 50px/100px; shape-outside:
ellipse(130px 140px at 20%
20%);}
没用。
像这样但没有边界的东西:https ://www.silhouettedesignstore.com/view-shape/79806
解决方案
仅通过使用 CSS,我能得到的最接近的东西就是这样的东西,虽然我不确定这是否是你要找的东西:
.foo {
display: block;
width: 100px;
height: 100px;
border: 1px solid #ccc;
transform: rotate(45deg);
margin: 30px;
border-radius: 2px;
}
.bar {
transform: rotate(-45deg);
}
<div class="foo">
<div class="bar">
Test
</div>
</div>
使用transform: rotate()
你可以旋转物体。
推荐阅读
- android - android - MaterialDatePicker Fullscreen:无法更改黑色状态栏颜色
- powershell - 在日志拖尾期间设置 Powershell 标题
- javascript - 如何在 HTML 和 JavaScript 中连续播放歌曲
- html - 使用绝对位置调整绘图画布的大小
- python - 在python中将自定义字符串格式的时间戳列转换为秒
- azure - 在自定义登录页面中添加自定义密码重置按钮 - Azure B2C
- python - 多输出预测(机器学习)
- flutter - Flutter 在 Widget 回调中传递 BuildContext
- c# - 如何在分配的变量值更改时停止变量更改C#
- javascript - 如何在 iframe 中更改音乐音量?