border实现对角

基本原理:

border-left:20px transparent dotted;

border-top:20px green solid;

border-right:20px transparent dotted;

border-bottom:20px orange solid;

width:0px;

height:0px;

overflow:hidden;

注意:transparent是用来透明的,并且要设置的线条的样式为dotted(点线)。宽高为0,就会只显示边框部分,然后用overflow来将多余部分截取掉,剩下的就是斜角内容了。

1border-leftborder-top组成从左上到右下的斜线

2border-rightborder-top组成从右上到左下的斜线

3border-rightborder-bottom组成从右下到左上的斜线

4border-leftborder-bottom组成从左下到右上的斜线


引荐别人写的一个css的border实现的风车

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="all" />
<meta name="author" content="colinivy" />
<link href="style/global.css" rel="stylesheet" type="text/css" media="screen" />
<title> Colinivy's world</title>
<style type="text/css">
	* {margin:0; padding:0; list-style:none;}
	body {
		font-size:63%;
	}
	#wrapper {
		margin:20px; 
		width:200px; 
		border: 1px solid #ccc; 
		font-size:1.2em;
	}
	#corner {
		position:relative; 
		top:-1px;
		left:-1px;
		width:0px; 
		height:0px; 
		overflow:hidden; 
		border-top:15px solid #fff; 
		border-right:15px solid #ccc; 
	}
	#wrapper p {
		padding:5px; 
		text-indent:20px;
	}
	#joy_left {
		width:20px; 
		height:0px; 
		overflow:hidden; 
		border-top:20px solid green;
		border-left:20px solid #FFF; 
	}
	#joy_top {
		top:-20px;
		width:0px;  
		height:20px; 
		border-top:20px solid #FFF;
		border-right:20px solid red; 
	}
	#joy_bottom {
		left:-40px;
		top:20px;
		width:0px; 
		height:20px; 
		border-left:20px solid blue;
		border-bottom:20px solid #FFF; 
	}
	#joy_right {
		left:-40px;
		top:20px ;
		width:20px; 
		height:0px; 
		overflow:hidden; 
		border-right:20px solid #FFF;
		border-bottom:20px solid #666; 
	}
	.por {
		position:relative; 
		float:left; 
	}
</style>
</head>
<body>
	<div id="wrapper" >
		<div id="corner">
		</div>
		<p>蓝色理想,你是偶的家园!</p>
		<p>蓝色理想,你是偶的家园!</p>
		<p>蓝色理想,你是偶的家园!</p>
	</div>
	<div id="joy_left" class="por">
	</div>
	<div id="joy_top" class="por">
	</div>
	<div id="joy_bottom" class="por">
	</div>
	<div id="joy_right" class="por">
	</div>
</body>
</html>




转载于:https://my.oschina.net/leonaLily/blog/423879

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值