首页 > 开发 > CSS > 正文

CSS三角箭头应用实践

2024-07-11 08:29:50
字体:
来源:转载
供稿:网友

用CSS来制作无图片带箭头的DIV方框(此代码比较适合追求纯代码者)
这类效果也可以用图片背景来实现,代码会更简洁
CSS代码:

CSS Code复制内容到剪贴板
  1. div.container{position:absolute;            top:30px;    
  2.        left:40px;            font-size: 9pt;    
  3.        display:block;            height:100px;    
  4.        width:200px;            background-color:transparent;    
  5.        *border:1px solid #666;            }    
  6.        s{            position:absolute;    
  7.        top:-20px;            *top:-22px;    
  8.        left:20px;            display:block;    
  9.        height:0;            width:0;    
  10.        font-size: 0;             line-height: 0;    
  11.        border-color:transparent transparent #666 transparent;            border-style:dashed dashed solid dashed;    
  12.        border-width:10px;            }    
  13.        i{position:absolute;            top:-9px;    
  14.        *top:-9px;            left:-10px;    
  15.        display:block;            height:0;    
  16.        width:0;            font-size: 0;    
  17.        line-height: 0;            border-color:transparent transparent #fff transparent;    
  18.        border-style:dashed dashed solid dashed;            border-width:10px;    
  19.        }            .content{    
  20.        border:1px solid #666;            -moz-border-radius:3px;    
  21.        -webkit-border-radius:3px;            position:absolute;    
  22.        background-color:#fff;            width:100%;    
  23.        height:100%;            padding:5px;    
  24.        *top:-2px;            *border-top:1px solid #666;    
  25.        *border-top:1px solid #666;            *border-left:none;    
  26.        *border-right:none;            *height:102px;    
  27.        box-shadow: 3px 3px 4px #999;            -moz-box-shadow: 3px 3px 4px #999;    
  28.        -webkit-box-shadow: 3px 3px 4px #999;            /* For IE 5.5 - 7 */    
  29.        filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#999999');            /* For IE 8 */    
  30.        -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#999999')";             }  
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表