为了账号安全,请及时绑定邮箱和手机立即绑定

如何只扭曲背景而不扭曲文字?

如何只扭曲背景而不扭曲文字?

缥缈止盈 2022-07-08 15:07:52
<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title><style>span{display: block;width:60px;height: 50px;line-height: 50px;align-self: center;padding: 30px;background-color: chartreuse;transform:skewY(10deg);transform:skewX(10deg);}</style></head><body><span>TEST</span></body></html>
查看完整描述

3 回答

?
猛跑小猪

TA贡献1858条经验 获得超8个赞

也可以这样:


<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title><style>span{display: block;width:60px;height: 50px;line-height: 50px;align-self: center;padding: 30px;background-color: chartreuse;transform:skewY(10deg);transform:skewX(10deg);}b{display: block;transform:skewY(-10deg);transform:skewX(-10deg);}</style></head> <body><span><b>TEST</b></span></body></html>




查看完整回答
反对 回复 2022-07-11
?
慕姐4208626

TA贡献1852条经验 获得超7个赞

必须要设置<span>为display:block,方可生效!亲测可用

查看完整回答
反对 回复 2022-07-11
?
海绵宝宝撒

TA贡献1809条经验 获得超8个赞

把背景和文字分成两个不同的元素即可,比如:


<!doctype html><html><head><meta charset="utf-8"><title>无标题文档</title><style>div {position:relative;}span.bk {display: block;width:120px;height: 110px;background-color: chartreuse;transform:skewY(10deg);transform:skewX(10deg);}span.ft {position:absolute;left:30px; top:30px;width:60px;height:50px;line-height: 50px;align-self: center;}</style></head><body><div><span class=bk></span><span class=ft>TEST</span></div></body></html>


查看完整回答
反对 回复 2022-07-11
  • 3 回答
  • 0 关注
  • 155 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号