前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >详解:55 transfrom-origin

详解:55 transfrom-origin

作者头像
贵哥的编程之路
发布2020-10-28 10:36:29
1710
发布2020-10-28 10:36:29
举报
文章被收录于专栏:用户7873631的专栏
代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>transfrom-origin</title>
	<link rel="stylesheet" type="text/css" href="css/reset.css">
	<style type="text/css">
		div{
			width: 200px;
			height: 200px;.
			border:5px solid red;
			margin:100px auto;
			background-color: #abcdef;
		}
		/**
		top left | left top 等价于 0 0;
top | top center | center top 等价于 50% 0
right top | top right 等价于 100% 0
left | left center | center left 等价于 0 50%
center | center center 等价于 50% 50%(默认值)
right | right center | center right 等价于 100% 50%
bottom left | left bottom 等价于 0 100%
bottom | bottom center | center bottom 等价于 50% 100%
bottom right | right bottom 等价于 100% 100%*/
		.box2{
			transform: rotate(30deg);
			transform-origin:top;
			transform-origin:top center;
			transform-origin:center top;
			transform-origin:50% 0;
			transform-origin:center;
			transform-origin:0 0;
		}
		.box3{
			transform:rotate(45deg);
		}
		.box3 span{
		display:block;
		line-height: 200px;
		text-align:center;
		transform:rotate(-45deg);
		}
	</style>
</head>
<body>
<div class="box1">box1</div>
<div class="box2">box2</div>
<div class="box3">
	<span>Mr.King</span>
</div>
</body>
</html>

核心:想要文字不跟着div转,怎么办? 用rotate取和div相反的数据,然后是 display: block;就行了.,

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020/08/19 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档