0
点赞
收藏
分享

微信扫一扫

用css画一个三角形

沉浸在自己的世界里 2022-04-13 阅读 36
css

1、

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title></title>
	<style type="text/css">
		.triangle{
			width: 0;
			height: 0;
			border:50px solid red;
			border-top-color: transparent;
			border-right-color: transparent;
			border-left-color: transparent;
		}
	</style>
</head>
<body>
	<div class="triangle"></div>
</body>
</html>

实现效果:
在这里插入图片描述
2、直角

<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title></title>
	<style type="text/css">
		.triangle{
			width: 0;
			height: 0;
			border:	50px solid red;
			border-top-color: transparent;
			border-right-color: transparent;
			border-left-color: red;
		}
	</style>
</head>
<body>
	<div class="triangle"></div>
</body>
</html>

实现效果:
在这里插入图片描述

举报

相关推荐

0 条评论