全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 python论坛
770 0
2016-04-16

我们在打开网页的时候,会经常发现边框上面有小三角形效果的应用,觉得在单调的矩形边框上增加小三角形效果,使网页效果更加美观,那么想要实现小三角形效果,应该怎么实现呢?下面给出的css教程(http://www.maiziedu.com/course/web/421-5342/)代码中主要介绍了实现小三角形效果的两种方式。具体代码如吓:
<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta name="author" content="http://www.softwhy.com/" />

<title>三种纯CSS实现三角形的方法</title>

<style type="text/css">

.message-box

{

  position:relative;

  float:left;

  margin:80px 0 0 100px;

  ;

  height:60px;

  line-height:60px;

  border:1px solid #000;

  text-align:center;

  color:#0C7823;

}

.triangle-border

{

  position:absolute;

  left:100px;

  overflow:hidden;

  width:0;

  height:0;

  border-;

  border-style:none dashed solid dashed;

}

.tb-border

{

  top:-10px;

  border-color:#000 transparent #000 transparent;

}

.tb-background

{

  top:-9px;

  border-color:transparent transparent #fff transparent;

}

/*字符*/

.triangle-character

{

  position:absolute;

  left:100px;

  overflow:hidden;

  ;

  height:26px;

  font:normal 26px "宋体";

}

.tc-background

{

  top:-12px;

  color:#FFF;

}

.tc-border

{

  top:-13px;

  color:#000;

}

</style>

</head>

<body>

<div class="message-box"> <span> border 属性实现</span>

  <div class="triangle-border tb-border"></div>

  <div class="triangle-border tb-background"></div>

</div>

<div class="message-box"> <span> ◆ 字符实现</span>

  <div class="triangle-character tc-border"></div>

  <div class="triangle-character tc-background"></div>

</div>

</body>

</html>

效果图片如下:

QQ截图20160302142921.png



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群