css3 transform的旋转和位移制作太阳花

css3 transform

  • 实例展示
  • 知识点
    • [rotate 旋转](#rotate 旋转)
    • [translate 位移](#translate 位移)
    • [transform: translate(300px,200px) rotate(90deg)](#transform: translate(300px,200px) rotate(90deg))
  • 实例代码

实例展示

知识点

transform的两个属性

rotate 旋转

translate 位移

transform: translate(300px,200px) rotate(90deg)

实例代码

javascript 复制代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			.circle{
				position: absolute;
				top:25%;
				left:25%;
				width: 200px;
				height: 200px;
				border-radius: 100px;
				border: red 2px dotted;
				background-color: yellow;
				box-sizing: border-box;
			}
			.box{
				width: 400px;
				height: 400px;
				position: absolute;
				left: 0px;
				right: 0px;
				background: #eee;
			}
			
			.txt{
				width: 100px;
				height: 30px;
				line-height: 25px;
				background: yellow;
				color: red; 
				transform-origin:left center;
				padding: 0 5px;
				border: red 2px dotted;
				box-sizing: border-box;
				position: absolute;
			}
			
		</style>
	</head>
	<body>
		<div class="box" style="z-index:99; background: transparent;">
			<div class="txt" style="transform: translate(100px,200px) rotate(180deg)">我爱我的家</div>
			<div class="txt" style="transform: translate(110px,140px) rotate(210deg)">我爱我的家</div>
			<div class="txt" style="transform: translate(150px,100px) rotate(240deg)">我爱我的家</div>
			
			<div class="txt" style="transform: translate(200px,85px) rotate(-90deg)">我爱我的家</div>
			<div class="txt" style="transform: translate(260px,105px) rotate(-60deg)">我爱我的家</div>
			<div class="txt" style="transform: translate(295px,150px) rotate(-30deg)">我爱我的家</div>
			
			<div class="txt" style="transform: translate(300px,200px) rotate(0deg)">我爱我的家</div>
			<div class="txt" style="transform: translate(280px,245px) rotate(30deg)">我爱我的家</div>
			<div class="txt" style="transform: translate(250px,270px) rotate(60deg)">我爱我的家</div>
			
			<div class="txt" style="transform: translate(200px,285px) rotate(90deg)">我爱我的家</div>
			<div class="txt" style="transform: translate(145px,270px) rotate(120deg)">我爱我的家</div>
			<div class="txt" style="transform: translate(115px,240px) rotate(150deg)">我爱我的家</div>
		</div>
		<div class="box" style="z-index:9">
			<div class="circle"></div>
			
			<!-- <div class="txt" style="transform: rotate(-30deg);margin-left: -5px;">我爱我的家</div>
			<div class="txt" style="transform: rotate(-10deg);margin-left: 10px;">我爱我的家</div>
			<div class="txt" style="transform: rotate(10deg);margin-left: 10px;">我爱我的家</div>
			<div class="txt" style="transform: rotate(30deg);margin-left: -5px;">我爱我的家</div>
			<div class="txt" style="transform: rotate(50deg);margin-left: -40px;margin-top: 10px;">我爱我的家</div>
			<div class="txt" style="transform: rotate(70deg);margin-left: -85px; margin-top: 0px;">我爱我的家</div> -->
		</div>
		
	</body>
</html>
相关推荐
Mr.Jessy2 小时前
Web APIs学习第一天:获取 DOM 对象
开发语言·前端·javascript·学习·html
午安~婉2 小时前
javaScript八股问题
开发语言·javascript·原型模式
西西学代码3 小时前
Flutter---个人信息(5)---持久化存储
java·javascript·flutter
芝麻开门-新起点3 小时前
flutter 生命周期管理:从 Widget 到 State 的完整解析
开发语言·javascript·ecmascript
ConardLi4 小时前
Easy Dataset 已经突破 11.5K Star,这次又带来多项功能更新!
前端·javascript·后端
冴羽4 小时前
10 个被严重低估的 JS 特性,直接少写 500 行代码
前端·javascript·性能优化
rising start4 小时前
四、CSS选择器(续)和三大特性
前端·css
一 乐4 小时前
高校后勤报修系统|物业管理|基于SprinBoot+vue的高校后勤报修系统(源码+数据库+文档)
java·前端·javascript·数据库·vue.js·毕设
那年窗外下的雪.5 小时前
鸿蒙ArkUI布局与样式进阶(十五)—— 模块化 · 自定义组件 · 泛型机制深度解析
javascript·华为·typescript·harmonyos·鸿蒙·arkui
一点七加一5 小时前
Harmony鸿蒙开发0基础入门到精通Day09--JavaScript篇
开发语言·javascript·ecmascript