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>
相关推荐
To_OC12 小时前
LC 51 N 皇后:我以为难的是回溯,结果栽在了对角线下标
javascript·算法·leetcode
小林ixn14 小时前
从零到一理解 React 父子组件通信:手写一个 Todo 应用带你彻底搞懂单向数据流
前端·javascript·react.js
窝子面17 小时前
手搓最简前后端协作-node
javascript·数据库
kyriewen17 小时前
我让AI给前端项目做了一次完整的Code Review——它和人类的差距,比我想的大得多
前端·javascript·ai编程
এ慕ོ冬℘゜18 小时前
前端基础:什么是时间戳?JS获取时间戳三种方法与实战用途
开发语言·前端·javascript
sugar__salt19 小时前
Vue3 表单双向绑定与响应式核心 API 技术详解
前端·javascript·vue.js
SmartBoyW19 小时前
CSS弹性布局(Flexbox)学习笔记:从零开始搞懂弹性布局
前端·javascript
用户9385156350720 小时前
写了这么久 useState,你真的知道它在干什么吗?
前端·javascript
烬羽20 小时前
递归老写崩?一个"退回"公式,把回溯题变成填空题
javascript·深度学习·算法
浮江雾21 小时前
Flutter第十七节-----路由管理(3)
android·开发语言·前端·javascript·flutter·入门