前端路线--HTML篇(day07)

边框三角形

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		.box{
			width: 0px;
			height: 0px;

			/*利用边框加厚,内容宽高为0,形成的三角形*/
			/*把其他的三个边调整为透明色,得到一个三角形*/
			border-top: 50px solid transparent;
			border-left: 50px solid transparent;
			border-right: 50px solid #f0f;
			border-bottom: 50px solid transparent;
		}
	</style>
</head>
<body>
	<div class="box">
		
	</div>
</body>
</html>

边框圆角

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		.box{
			width: 405px;
			height: 405px;
			margin: 100px auto;
			border:1px solid #000;
		}
		.box div{
			width: 200px;
			height: 200px;
			display: inline-block;

		}
		.box1{
			background-color: #f00;
			border-radius: 0px 200px;
			/*边框圆角*/
		}
		.box2{
			background-color: #ff0;
			border-radius: 200px 0px;
		}
		.box3{
			background-color: #0ff;
			border-radius: 200px 0px;
		}
		.box4{
			background-color: #f0f;
			border-radius: 0px 200px;
		}

		.box:hover{
			transition: 5s;
			transform: rotateZ(3600deg);
		}
	</style>
</head>
<body>
	<div class="box">
		<div class="box1"></div>
		<div class="box2"></div>
		<div class="box3"></div>
		<div class="box4"></div>
	</div>
</body>
</html>

计算盒子模型

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		.demo{
			width:200px;
			height:200px;
			border:1px solid red; 
			padding:20px;
		}
		.demo1{
			width: 373px;
			height: 398px;
			padding-left:25px;
			border: 1px solid red;
		}
		.box{
			width: 400px;
			height: 400px;
			border:1px solid #000;
		}
		.box1{
			width: 200px;
			height: 200px;
			border:1px solid #000;

			margin: 100px;
		}
	</style>
</head>
<body>
	<div class="demo"></div>
	<div class="demo1"></div>

	<div class="box">
		<div class="box1"></div>
	</div>

	<!-- 一个盒子需要占用的空间是 400*400, 但是盒子又有 padding-left:25px, border: 1px solid red; 问,我们需要改动盒子宽度为多少?

	如何让一个200 200像素的盒子, 在一个400 400的盒子里面水平居中,垂直居中。 -->
</body>
</html>

浮动

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		.box1{
			width: 200px;
			height: 200px;
			background-color: #00f;

			/*左浮动:脱离文档流,浮动元素从左到右依次排列*/
			float: left;
		}
		.box2{
			width: 200px;
			height: 200px;
			background-color: #ff0;

			float: left;
		}
		.box3{
			width: 200px;
			height: 200px;
			background-color: #f0f;
			/*右浮动*/
			float: right;
		}
	</style>
</head>
<body>
	<div class="box1"></div>
	<div class="box2">你好发生发</div>
	<div class="box3"></div>
</body>
</html>

清除浮动

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		.box1{
			width: 200px;
			height: 200px;
			background-color: #00f;

			/*左浮动:脱离文档流,浮动元素从左到右依次排列*/
			float: left;
		}
		.box2{
			width: 200px;
			height: 200px;
			background-color: #ff0;

			float: left;
		}
		.box3{
			width: 200px;
			height: 200px;
			background-color: #f0f;
			/*右浮动*/
			float: right;
		}

		.box4{
			width: 100%;
			height: 100px;
			background-color: #000;
		}
		.box{
			width: 100%;
			height: 200px;
		}
	</style>
</head>
<body>
	<!-- 解决浮动带来的影响: -->
		<!-- 给浮动元素添加父元素,给父元素设置宽高 -->
	<div class="box">
		<div class="box1"></div>
		<div class="box2">你好发生发</div>
		<div class="box3"></div>
	</div>

	<div class="box4">
		
	</div>
</body>
</html>

网页布局1

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		/*清除默认样式*/
		*{
			margin: 0;
			padding: 0;
			list-style-type: none;
		}
		.nav{
			width: 1200px;
			height: 80px;
			margin: 0 auto;
		}
		.nav .logo{
			width: 200px;
			height: 80px;
			float: left;
		}
		.nav ul{
			width: 800px;
			height: 80px;
			float: right;
		}
		.nav ul li{
			width: 100px;
			height: 80px;
			float: left;
			text-align: center;
			line-height: 80px;
		}

		.navbar{
			width: 100%;
			height: 40px;
			background-color: #999;
		}
		.navbar-layout{
			width: 1200px;
			height: 40px;
			margin: 0 auto;
		}
	</style>
</head>
<body>
	<div class="nav">
		<div class="logo">
			<img src="img/logo.jpg" alt="">
		</div>
		<ul>
			<li>首页</li>
			<li>关于利人</li>
			<li>关于利人</li>
			<li>关于利人</li>
			<li>关于利人</li>
			<li>关于利人</li>
			<li>关于利人</li>
			<li>关于利人</li>
		</ul>
	</div>

	<div class="navbar">
		<div class="navbar-layout">
			
		</div>
	</div>
</body>
</html>

网页布局2

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
	<style>
		/*清除默认样式*/
		*{
			margin: 0;
			padding: 0;
			list-style-type: none;
		}

		.box{
			width: 1000px;
			height: 300px;
			margin: 0 auto;
			/*border:1px solid red;*/
		}
		.box div{
			width: 300px;
			height: 300px;
			float: left;
			/*border:1px solid red;*/
			text-align: center;
		}
		.box div img{
			border-radius: 50%;
			margin: 50px 0px 30px;
		}
		.box .middle{
			margin: 0px 47px;
		}
	</style>
</head>
<body>
	<div class="box">
		<div>
			<img src="img/icon-01.jpg" alt="">
			<h2>行业解决方案</h2>
			<p>
				客户服务体系,对讲集群系统<br>手机名片,移动业务,解决方案
			</p>
		</div>
		<div class="middle">
			<img src="img/icon-02.jpg" alt="">
			<h2>行业解决方案</h2>
			<p>
				客户服务体系,对讲集群系统<br>手机名片,移动业务,解决方案
			</p>
		</div>
		<div>
			<img src="img/icon-03.jpg" alt="">
			<h2>行业解决方案</h2>
			<p>
				客户服务体系,对讲集群系统<br>手机名片,移动业务,解决方案
			</p>
		</div>
	</div>
	<p>
		—————————————— P U O D U C T ——————————————
	</p>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值