虚拟主机域名注册-常见问题网络编程问题 → CSS/HTML


CSS 实现三角形尖角箭头的实例
作者:
<!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>无标题文档</title>
<style type="text/css">
.area {
    margin:100px auto;
    width:300px; 
    height: 150px; 
}
.item {
    float:left; clear:both;
    margin-bottom:23px;
}
/* 向上的箭头 */
.dot-top {
    font-size: 0;
    line-height: 0;
    border-width: 10px;
    border-color: red;
    border-top-width: 0;
    border-style: dashed;
    border-bottom-style: solid;
    border-left-color: transparent;
    border-right-color: transparent;
}
/* 向右的箭头 */
.dot-right {
    font-size: 0;
    line-height: 0;
    border-width: 10px;
    border-color: red;
    border-right-width: 0;
    border-style: dashed;
    border-left-style: solid;
    border-top-color: transparent;
    border-bottom-color: transparent;
}
/* 向下的箭头 */
.dot-bottom {
    font-size: 0;
    line-height: 0;
    border-width: 10px;
    border-color: red;
    border-bottom-width: 0;
    border-style: dashed;
    border-top-style: solid;
    border-left-color: transparent;
    border-right-color: transparent;
}
/* 向左的箭头 */
.dot-left {
    font-size: 0;
    line-height: 0;
    border-width: 10px;
    border-color: red;
    border-left-width: 0;
    border-style: dashed;
    border-right-style: solid;
    border-top-color: transparent;
    border-bottom-color: transparent;
}
</style>
</head>
                               
<body>
<div class="area">
    <span class="item dot-top"></span>
    <span class="item dot-right"></span>
    <span class="item dot-bottom"></span>
    <span class="item dot-left"></span>
</div>
</body>
</html>

另外我后来发现通过设置不同方向边线宽度,还可以调整斜角的角度;修改bord-width的值,修改三角形的大小,这个很简单大家自己修改尝试下吧就不赘述啦



来源:
阅读:2411
日期:2017-08-26

推荐朋友 】 【 评论 】  【 字体: 】 
上一篇:apache、iis6、ii7通过伪静态屏蔽限制ip访问(适用虚拟主机)
下一篇:JS获取浏览器窗口大小 网页宽度高度 屏幕浏览器网页高度宽度
  >> 相关文章
  没有相关文章。
发表评论


点  评: 字数0
用户名:  密码:

  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款