前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >border的transparent与rgba(0)的区别是什么?

border的transparent与rgba(0)的区别是什么?

作者头像
练小习
发布2017-12-29 11:15:37
6490
发布2017-12-29 11:15:37
举报
文章被收录于专栏:练小习的专栏

在用after和before做一个小的tips箭头的时候,发现一个很蛋疼的问题,boeder写成transparent和写成rgb(x,x,x,0),在webkit下无区别,在moz下表现明显不同,transparent颜色会深很多,困惑中,有答案的兄弟麻烦给个答案…..下面是实例 1.transparent

<!DOCTYPE html>

<html lang="en">

<head>

<style>

*{

margin:0;

padding:0;

}

.tips{

width:auto;

border:#e8e8e8 1px solid;

background:#fff;

position:absolute;

z-index: 9999;

}

.tips::after,.tips::before{

display:block;

content: "";

width:0;

height:0;

position:absolute;

left:13px;

border: solid transparent;

top:100%;

}

.tips-b::before{

border-color: transparent;

border-top-color:rgba(232, 232, 232,1);

border-width:7px;

margin-left:-3px;

z-index: 1;

}

.tips-b::after{

border-color: transparent;

border-top-color:rgba(255, 255, 255,1);

border-width:6px;

margin-left:-2px;

z-index: 2;

}

</style>

</head>

<body >

<div class="tips tips-b" style="width:100px; height:50px; top:100px; left:50px;"></div>

</body>

</html>

提示:你可以先修改部分代码再运行。

2.rgba

<!DOCTYPE html>

<html lang="en">

<head>

<style>

*{

margin:0;

padding:0;

}

.tips{

width:auto;

border:#e8e8e8 1px solid;

background:#fff;

position:absolute;

z-index: 9999;

}

.tips::after,.tips::before{

display:block;

content: "";

width:0;

height:0;

position:absolute;

left:13px;

border: solid transparent;

top:100%;

}

.tips-b::before{

border-color: rgba(232, 232, 232, 0);

border-top-color:rgba(232, 232, 232,1);

border-width:7px;

margin-left:-3px;

z-index: 1;

}

.tips-b::after{

border-color: rgba(255, 255, 255, 0);

border-top-color:rgba(255, 255, 255,1);

border-width:6px;

margin-left:-2px;

z-index: 2;

}

</style>

</head>

<body >

<div class="tips tips-b" style="width:100px; height:50px; top:100px; left:50px;"></div>

</body>

</html>

提示:你可以先修改部分代码再运行。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档