尖角在上面
效果图:
代码:
<html>
<head>
<title>尖角div</title>
<style type="text/css">
#top
{
width:400px;
height:250px;
border:3px solid; /* 边框宽度为3px */
position:relative;
}
.sp1,.sp2
{
display:block;
height:0px;
width:0px;
position:absolute;
font-size:0;
line-height:0;
}
.sp1
{
top:-9px; /* 它的绝对值加上span的边框宽度等于div边框宽度的5倍 */
left:40px; /* 它来确定尖角的位置 */
border-top:0px;
border-bottom:6px solid black; /* 注意颜色的变化 */
border-right:6px