css - 文字的角度,使其在图像上看起来更自然
问题描述
使用 CSS,我想知道如何使该图像上的文本看起来更像实际图像上的文本?
HTML
<span className="mainPicTitle">How can i make this text angle so it suits the wall?</span>
CSS
.mainPicTitle {
font-size: 40px;
color: #000000;
background-color: transparent;
grid-column: 1 / 4;
grid-row: 1/1;
margin-top: 1em;
justify-self: center;
font-family: 'Alegreya Sans SC', sans-serif;
}
非常感谢所有建议。
解决方案
您可以使用 css 3d 或倾斜变换规则将文本设置为所需的角度。我制作了一个大角度的示例片段,以显示您可能需要将角度设置为精确的效果。
更多关于这里的变换。
#wrapper{
position:relative;
}
.mainPicTitle {
position:absolute;
top:200px;
left:100px;
font-size: 50px;
color: #000000;
z-index:2;
transform-style: preserve-3d;
transform: rotateX(-65deg) rotateY(2deg);
}
img{
position:absolute;
top:0;
left:0;
}
<div id="wrapper">
<span class="mainPicTitle">How can i make this text angle so it suits the wall?</span>
<img src="https://i.stack.imgur.com/cyUow.png">
</div>
推荐阅读
- android - 如何在 react-navigation-material-bottom-tabs 中添加标签栏的阴影?
- laravel - 如何限制 whereHas 只匹配 where 条件?
- java - 如何访问添加到尚未声明的 JPanel 的 swing 组件?
- c# - 从超类调用重载构造函数后要调用的强制方法
- android - 在 Android API Level 15+ 上进行 AES-GCM 加密
- android - 如何将文件从 Firebase 存储下载到自定义文件夹?
- android - 如何在应用程序中模仿设备的弯曲边缘?
- python - 如何构建正则表达式捕获索引
- r - chisq.test: x and y must have the same length
- googletest - Does Google Test have assumeSomthing macros?