请问:css如何实现一个向下的三角形边框(border)?不明白的可以看下面图例。谢谢!

图片已经付上... 图片已经付上 展开
 我来答
a3476012
2015-12-15 · TA获得超过1268个赞
知道小有建树答主
回答量:484
采纳率:87%
帮助的人:133万
展开全部

根据你的图片,达到这种效果有2种方法:

    1.用图片png图片作为背景;

    2.可以用纯css就可以达到,举个例子:

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title>Document</title>

<style type="text/css">

body{

    background-color: #444;

}

.test{

    width: 15px;

    height: 30px;

    box-sizing:border-box;

    border-top: 15px solid #f5f5f5;

    border-bottom: 15px solid #f5f5f5;

    /*border-left: 20px solid #0f0;*/

    border-right: 15px solid transparent;

   /* border-top-right-radius: 4px;

    border-radius: 12px;*/

}

.csspic{

    width: 200px;

    height: 400px;

    margin:50px auto;

    background:  url(images/5.jpg) -15px top no-repeat;

    -webkit-background-size: cover;

    background-size: cover;

    border-radius: 10px;

    position: relative;

    border: 15px solid #f5f5f5;

    -moz-background-clip: border;

    -webkit-background-clip: border-box;

    -o-background-clip: border-box;

    background-clip: border-box;

}

.img{    

    overflow: hidden;

    width: 260px;

    height: 400px;

}

.sjx{

    position: absolute;

    top:30px;

    left: -15px;

    background:  url(images/5.jpg) left -30px no-repeat;

    -webkit-background-size: 500px;

    background-size: 500px;

    z-index: 9999;

}

.csspic img{

    height: 100%;

</style>

</head>

<body>

    

    

    <div class="csspic">

        <div class="sjx">

            <div class="test"></div>

        </div>

        <div class="img"><!-- <img src="images/5.jpg"> --></div>

        

    </div>

</body>

</html>

369383066
2011-09-21 · TA获得超过1887个赞
知道大有可为答主
回答量:2686
采纳率:50%
帮助的人:1419万
展开全部
求图
追问
图已经付上
追答
如楼下
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
flasharrow2001
2011-09-21 · TA获得超过337个赞
知道小有建树答主
回答量:175
采纳率:0%
帮助的人:162万
展开全部
<!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" />
<title>用css的border属性实现三角</title>
<style type="text/css">
<!--
.box{ width:300px; height:300px; background:#CCC; position:relative; top:100px;left:100px }
.to-top{display:block; overflow:hidden; width:0px; height:0px; border:6px solid #ccc; border-color:#ccc #fff; border-width:0 6px 6px 6px; position:absolute; left:30px; top:0;margin-top:-6px;}
.to-right{display:block; overflow:hidden; width:0px; height:0px; border:6px solid #ccc; border-color:#fff #ccc; border-width:6px 0 6px 6px; position:absolute; right:0px; top:30px;margin-right:-6px;}
.to-bottom{display:block; overflow:hidden; width:0px; height:0px; border:6px solid #ccc; border-color:#ccc #fff; border-width:6px 6px 0 6px; position:absolute; right:30px; bottom:0;margin-bottom:-6px;}
.to-left{display:block; overflow:hidden; width:0px; height:0px; border:6px solid #ccc; border-color:#fff #ccc; border-width:6px 6px 6px 0 ; position:absolute; left:0; bottom:30px;margin-left:-6px;}
-->
</style>
</head>

<body>
<div class="box"><em class="to-top"></em><em class="to-right"></em><em class="to-bottom"></em><em class="to-left"></em></div>

</body>
</html>
源码奉上,看吧,利用border
追问
确实可以!谢谢!我没金币了!下次怎么问你呢?告诉我你的QQ?
追答
确定我的为最佳答案就行了,有问题直接给我百度这个帐号发信就行
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式