css 定位

一、定位
普通流定位:(元素默认的定位方式)position:static
浮动定位:float left right
clear :left 清除左浮动 right 清除右浮动 both 不管是左右都清除

相对定位:position:relative
绝对定位:position:absolute
固定定位:position:fixed
z-index:调整元素的图层 :只有使用在 相对定位 绝对定位 固定定位上 浮动并不能使用

CSS的伪类:hover:鼠标触碰到元素时触发的伪类

显示相关:display:none 让元素的分类变为空 从而不见
visibility 显示/隐藏元素
visible 可见的
hidden 隐藏的
collapse 使用在表格元素上 ,删除一行或者一列 不影响表格整体布局

opacity: 改变元素的透明度

光标的属性
属性:cursor
default 默认的属性
pointer 手
crosshair +
text 文本
wait 加载等待
help 帮助

列表的属性
list-style:none; /*去掉项目符号 circle 空心圆点 disc 实心圆点 square 实心正方形 */
/list-style-image:url(img/111.jpg);/ 项目符号图片
/list-style-position:inside;/项目图片与项目在一起

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>诗单</title>
		<style type="text/css">
			body{
				margin: 0px;
				display: flex;
				justify-content: center;
			}
			.father{
				width: 700px;
				height: 900px;
				background-color: #E1E0C7;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: space-around;
			}
			.son1,.son2,.son3{
				width: 628px;
				border: 1px solid #C8C7BC;
				border-radius: 5px;
				background-color: #F0EFE2;
				padding: 15px 20px;
			}
			.libai,.suidiao,.shinian{
				width: 628px;
			}
			.libai-top{
				width: 628px;
				height: 160px;
				display: flex;
				justify-content: center;
			}
			.libai-tu{
				width: 128px;
			}
			.libai-span{
				width: 500px;
			}
			.span-top{
				height: 35px;
				font-size: 20px;
				font-weight: bold;
				display: flex;
				justify-content: flex-start;
			}
			.span-tu{
				width: 20px;
				height: 20px;
				background-image: url(img/speaker.png);
				background-repeat: no-repeat;
				background-size: cover;
				margin-top: 5px;
				margin-left: 10px;
			}
			.span-body{
				font-size: 14px;
				line-height: 28px;
			}
			.libai-weibu,.suidiao-biaoqian{
				width: 626px;
				height: 40px;
				display: flex;
				justify-content: flex-start;
				align-items: center;
				color: #CEB099;
				font-size: 10px;
			}
			.libai-weibu span,.suidiao-biaoqian span{
				margin-top: 15px;
			}
			.weibu-tu1,.weibu-tu2,.weibu-tu3,.weibu-tu4,.weibu-tu5,.biaoqian-tu1,.biaoqian-tu2{
				display: block;
				width: 20px;
				height: 20px;
				margin: 7px 20px 0px 0px;
				background-repeat: no-repeat;
				background-size: cover;
			}
			.weibu-tu1{
				background-image: url(img/shoucang.png);
			}
			.weibu-tu2{
				background-image: url(img/copy.png);
			}
			.weibu-tu3{
				background-image: url(img/weixin.png);
			}
			.weibu-tu4{
				background-image: url(img/write.png);
			}
			.weibu-tu5{
				background-image: url(img/good.png);
				margin-left: auto;
				margin-right: 6px;
			}
			.suidiao{
				height: 310px;
			}
			.cimin{
				height: 26px;
				display: flex;
				justify-content: space-between;
			}
			.cimin span{
				font-size: 20px;
				color: #19537D;
				font-weight: bold;
				line-height: 26px;
			}
			.cimin-tu{
				display: flex;
				justify-content: center;
			}
			.cimin-tu1,.cimin-tu2,.cimin-tu3,.cimin-tu4{
				display: block;
				width: 26px;
				height: 26px;
				margin: 7px 20px 0px 0px;
				background-repeat: no-repeat;
				background-size: cover;
			}
			.cimin-tu1{
				background-image: url(img/yipic.png);
			}
			.cimin-tu2{
				background-image: url(img/zhupic.png);
			}
			.cimin-tu3{
				background-image: url(img/shangpic.png);
			}
			.cimin-tu4{
				background-image: url(img/beipic.png);
			}
			.biaoqian-tu1{
				background-image: url(img/write.png);
			}
			.biaoqian-tu2{
				background-image: url(img/bootmright.png);
			}
			.suidiao-body{
				/*height: 215px;*/
			}
			.body-span1{
				display: block;
				font-size: 10px;
				color: #65645F;
				line-height: 40px;
			}
			.body-span2{
				display: block;
				line-height: 40px;
			}
			.body-span3{
				display: block;
				font-size: 14px;
				line-height: 27px;
			}
			.weibu-span{
				font-size: 14px;
				color: #999999;
				line-height: 27px;
			}
		</style>
	</head>
	<body>
		<div class="father">
			<div class="son1">
				<div class="libai">
					<div class="libai-top">
						<div class="libai-tu">
							<img src="img/libai.jpg"/>
						</div>
						<div class="libai-span">
							<div class="span-top">
								李白
								<div class="span-tu"></div>
							</div>
							<div class="span-body">
								李白(701年-762年),字太白,号青莲居士,唐朝浪漫主义诗人,被后人誉
								为“诗仙”。祖籍陇西成纪(待考),出生于西域碎叶城,4岁再随父迁至剑南道绵州。
								李白存世诗文千余篇,有《李太白集》传世。762年病逝,享年61岁。其墓在今安
								徽当涂,四川江油、湖北安陆有纪念馆。
								<a href="#" style="text-decoration: none;color: #19537D;">▶ 1310篇诗文</a>
							</div>
						</div>
					</div>
					<div class="libai-weibu">
						<a href="#" class="weibu-tu1"></a>
						<a href="#" class="weibu-tu2"></a>
						<a href="#" class="weibu-tu3"></a>
						<a href="#" class="weibu-tu4"></a>
						<a href="#" class="weibu-tu5"></a>
						<span>6171</span>
					</div>
				</div>
			</div>
			<div class="son2">
				<div class="suidiao">
					<div class="cimin">
						<span>水调歌头·明月几时有</span>
						<div class="cimin-tu">
							<a href="#" class="cimin-tu1"></a>
							<a href="#" class="cimin-tu2"></a>
							<a href="#" class="cimin-tu3"></a>
							<a href="#" class="cimin-tu4"></a>
						</div>
					</div>
					<div class="suidiao-body">
						<span class="body-span1">宋代:苏轼</span>
						<span class="body-span2">丙辰中秋,欢饮达旦,大醉,作此篇,兼怀子由。</span>
						<span class="body-span3">
							明月几时有?把酒问青天。不知天上宫阙,今夕是何年。我欲乘风归去,又恐琼楼玉宇,
							高处不胜寒。起舞弄清影,何似在人间?(何似 一作:何时;又恐 一作:惟/唯恐)<br />
							转朱阁,低绮户,照无眠。不应有恨,何事长向别时圆?人有悲欢离合,月有阴晴圆缺,
							此事古难全。但愿人长久,千里共婵娟。(长向 一作:偏向)
						</span>
					</div>
					<div class="suidiao-biaoqian">
						<a href="#" class="weibu-tu1"></a>
						<a href="#" class="weibu-tu2"></a>
						<a href="#" class="weibu-tu3"></a>
						<a href="#" class="weibu-tu4" style="background-image: url(img/speaker.png);"></a>
						<a href="#" class="weibu-tu5"></a>
						<span>33479</span>
					</div>
					<hr size="1" color="#DAD9D1"/>
					<span class="weibu-span">宋词三百首,宋词精选,初中古诗,高中古诗,豪放,中秋节,月亮,怀人,祝福</span>
				</div>
			</div>
			<div class="son3">
				<div class="shinian">
					<div class="cimin">
						<span style="color: black;">十年生死两茫茫,不思量,自难忘。</span>
						<div class="cimin-tu">
							<a href="#" class="cimin-tu1"></a>
							<a href="#" class="cimin-tu2"></a>
							<a href="#" class="cimin-tu3"></a>
							<a href="#" class="cimin-tu4"></a>
						</div>
					</div>
					<div class="suidiao-body">
						<span class="body-span1">出自宋代<a href="#" style="text-decoration: none;">苏轼</a>的《<a href="#" style="text-decoration: none;">江城子·乙卯正月二十日夜记梦</a>》</span>
						<span class="body-span2"></span>
						<span class="body-span3">
							十年生死两茫茫,不思量,自难忘。千里孤坟,无处话凄凉。纵使相逢应不识,尘满面,鬓如霜。
							<br />
							夜来幽梦忽还乡,小轩窗,正梳妆。相顾无言,惟有泪千行。料得年年肠断处,明月夜,短松冈。(肠断 一作:断肠)
						</span>
					</div>
					<div class="suidiao-biaoqian">
						<a href="#" class="weibu-tu1"></a>
						<a href="#" class="weibu-tu2"></a>
						<a href="#" class="weibu-tu3"></a>
						<a href="#" class="weibu-tu4" style="background-image: url(img/speaker.png);"></a>
						<a href="#" class="biaoqian-tu1"></a>
						<a href="#" class="biaoqian-tu2"></a>
						<a href="#" class="weibu-tu5"></a>
						<span>1251</span>
					</div>
					<hr size="1" color="#DAD9D1"/>
					<span class="weibu-span">宋词三百首,婉约,悼亡,爱情,记梦,思念</span>
				
				</div>
			</div>
		</div>
	</body>
</html>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			.father{
				width: 400px;
				height: 400px;
				border: 1px solid black;
			}
			.son1,.son2,.son3,.son4{
				width: 100px;
				height: 100px;
			}
			.son1{
				background-color: red;
				float: left;
			}
			.son2{
				background-color: green;
				float: left;
			}
			.son3{
				background-color: yellow;
				float: left;
			}
			.son4{
				background-color: blue;
				float: left;
			}
		</style>
	</head>
	<body>
		<div class="father">
			<div class="son1"></div>
			<div class="son2"></div>
			<div class="son3"></div>
			<div class="son4"></div>
		</div>
	</body>
</html>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			.father{
				width: 1350px;
				height: 50px;
				background-color: white;
				margin: 0 auto;
			}
			.father ul{
				width: 1350px;
				list-style:none;
				padding: 0px;
				margin: 0 auto;
			}
			.father ul li{
				width: 50px;
				height: 50px;
				color: black;
				text-align: center;
				line-height: 50px;
				float: left;
			}
			.father ul li:hover{
				color: #00BFFF;
				border-bottom: 2px solid #00BFFF;
			}
			.son1{
				clear: both;
			}
		</style>
	</head>
	<body>
		<div class="father">
			<ul>
				<a href="#"><li>首页</li></a>
				<li>剧集</li>
				<li>电影</li>
				<li>综艺</li>
				<li>音乐</li>
				<li>少儿</li>
				<li>来疯</li>
				<li>直播</li>
				<li>片库</li>
				<li>拍客</li>
				<li>咨询</li>
				<li>纪实</li>
				<li>公益</li>
				<li>体育</li>
				<li>汽车</li>
				<li>科技</li>
				<li>财经</li>
				<li>娱乐</li>
				<li>原创</li>
				<li>动漫</li>
				<li>搞笑</li>
				<li>旅游</li>
				<li>时尚</li>
				<li>亲子</li>
				<li>教育</li>
				<li>游戏</li>
				<li>更多</li>
			</ul>
			<div class="son1"></div>
		</div>
	</body>
</html>

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<style type="text/css">
			.father{
				width: 300px;
				height: 300px;
				border: 1px solid black;
				margin: 0 auto 10px;
			}
			
			/*相对定位*/
			.son1{
				width: 100px;
				height: 100px;
				background-color: red;
				/*相对定位*/
				position: relative;
				top: 100px;
				left: 100px;
				/*图层 大的显示*/
				z-index: 3;
			}
			.son2{
				width: 100px;
				height: 100px;
				background-color: yellow;
				
				position: relative;
				left: 100px;
				z-index: 2;
			}
			.son3{
				width: 100px;
				height: 100px;
				background-color: blue;
			}
			
			/*绝对定位*/
			.son4{
				width: 100px;
				height: 100px;
				background-color: red;
				position: absolute;
				top: 100px;
				left: 100px;
				z-index: 4;
			}
			.son5{
				width: 100px;
				height: 100px;
				background-color: yellow;
				position: absolute;
				top: 150px;
				left: 150px;
				z-index: 3;
			}
			.son6{
				width: 100px;
				height: 100px;
				background-color: blue;
			}
			
			/*固定定位*/
			.son7{
				width: 100px;
				height: 100px;
				background-color: red;
				position: fixed;
				top: 50%;
				left: 50%;
				transform: translate(-50%,-50%);
				z-index: 5;
			}
			.son8{
				width: 100px;
				height: 100px;
				background-color: yellow;
				position: fixed;
				bottom: 100px;
				right: 100px;
			}
			.son9{
				width: 100px;
				height: 100px;
				background-color: blue;
			}
		</style>
	</head>
	<body>
		<div class="father">
			<div class="son1"></div>
			<div class="son2"></div>
			<div class="son3"></div>
		</div>
		<div class="father">
			<div class="son4"></div>
			<div class="son5"></div>
			<div class="son6"></div>
		</div>
		<div class="father">
			<div class="son7"></div>
			<div class="son8"></div>
			<div class="son9"></div>
		</div>
		<div class="father"></div>
		<div class="father"></div>	
		<div class="father"></div>
		<div class="father"></div>
		<div class="father"></div>
		<div class="father"></div>
		<div class="father"></div>
		<div class="father"></div>
	</body>
</html>

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值