带背景颜色的小三角实现

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>带背景颜色的小三角实现</title>

<style>
#top {

position: absolute;
width: 0px;
height: 0px;
line-height: 0px;/*为了防止ie下出现题型*/
border-bottom: 10px solid #89b007;
border-left: 10px solid #fff;
border-right: 10px solid #fff;
left: 76px;
top: -10px;
}
#right {

position: absolute;
width: 0px;
height: 0px;
line-height: 0px;
border-left: 10px solid #89b007;
border-bottom: 10px solid #fff;
border-top: 10px solid #fff;
left: 300px;
top: 40px;

}
#left {

position: absolute;
width: 0px;
height: 0px;
line-height: 0px;
border-right: 10px solid #89b007;
border-bottom: 10px solid #fff;
border-top: 10px solid #fff;
left: -10px;
top: 40px;

}
#bottom {

position: absolute;
width: 0px;
height: 0px;
line-height: 0px;
border-top: 10px solid #89b007;
border-left: 10px solid #fff;
border-right: 10px solid #fff;
left: 104px;
top:150px;

}
#first {
border-radius:8px;
-moz-border-radius:8px;-ms-border-radius:8px;-o-border-radius:8px;-webkit-border-radius:8px;
position: absolute;
height: 150px;
width: 300px;
background: #89b007;
left: 22px;
top: 33px;

}
#first p{ padding:10px; line-height:1.5; color:#FFF;}
#first1 {
border-radius:8px;
-moz-border-radius:8px;-ms-border-radius:8px;-o-border-radius:8px;-webkit-border-radius:8px;
position: absolute;
height: 150px;
width: 300px;
background: #89b007;
left: 22px;
top: 33px;
margin-top:160px

}
#first1 p{ padding:10px; line-height:1.5; color:#FFF;}

#first2 {
border-radius:8px;
-moz-border-radius:8px;-ms-border-radius:8px;-o-border-radius:8px;-webkit-border-radius:8px;
position: absolute;
height: 150px;
width: 300px;
background: #89b007;
left: 22px;
top: 33px;
margin-top:320px

}
#first2 p{ padding:10px; line-height:1.5; color:#FFF; }
#first3 {
border-radius:8px;
-moz-border-radius:8px;-ms-border-radius:8px;-o-border-radius:8px;-webkit-border-radius:8px;
position: absolute;
height: 150px;
width: 300px;
background: #89b007;
left: 22px;
top: 33px;
margin-top:480px;
margin-bottom:40px;

}
#first3 p{ padding:10px; line-height:1.5; color:#FFF; }

</style>
</head>

<body>
<div id="first">
<p>带背景颜色的小三角实现是比较简单的!</p>
<span id="top"></span>
</div>

<div id="first1">
<p>带背景颜色的小三角实现是比较简单的!</p>
<span id="right"></span>
</div>
<div id="first2">
<p>带背景颜色的小三角实现是比较简单的!</p>
<span id="left"></span>
</div>
<div id="first3">
<p>带背景颜色的小三角实现是比较简单的!</p>
<span id="bottom"></span>
</div>

</body>

</html>

效果图

时间: 2024-07-31 06:22:57

带背景颜色的小三角实现的相关文章

原生JS写了一个小demo,根据输入的数字生成不同背景颜色的小方块儿~

昨天练习写了这个小demo,个人觉得通过设置定位元素left和top的值,来实现换行的功能,这种方法很巧妙~ 另外,如下代码中的随机颜色的获取,还请各位前辈多多指教:需要改进的地方:或者有没有更好的方法. 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title></title> 6 <style type="text

解决设置selectedBackgroundView后会把cell上带背景颜色的控件遮住的问题

再给cell自定义选中的背景色时,当选中后会把cell上原来有背景色的控件遮住就像消失了一样,可以用下面的方法解决 我定义的cell的选中背景色是绿色 UIView *bgView = [[UIView alloc]initWithFrame:programCell.bg_View.bounds]; bgView.backgroundColor = [UIColor greenColor]; Cell.selectedBackgroundView = bgView; 未选中的效果 选中时的效果

PDF如何添加背景颜色,操作的小方法

PDF文档如何添加背景颜色呢?现在很多人都喜欢来一些背景颜色,当然PDF文档也是可以添加背景颜色的,下面小编就为大家操作一下PDF文档添加背景颜色的小方法.操作软件:迅捷PDF编辑器软件地址:https://www.xunjiepdf.com/editor1:将PDF编辑器安装到自己的电脑中,打开软件就会看到打开更多文件,点击选择需要添加背景色的PDF文档.2:在软件的上方找到文档,点击文档就会看到背景,将鼠标移动到背景就可以找到添加,点击添加后,会出现一个选框.3:在选框中找到颜色,将背景色设

纯css写带小三角对话框

在实际样式中经常会遇到要写类似对话框的样式,而这种样式往往会有一个小三角,如下所示: 那么如何用css写出来呢,其实很简单,先让父元素相对定位,然后运用css的伪类before或after.就可以写个三角形,如果想要带边框的三角形,则可以两个重叠使用.代码如下: <div class="box2"> 纯css写带小三角对话框 </div> .box2{ float:left; position:relative; width:200px; height:100p

【小技巧】只用css实现带小三角的对话框样式

一个小小的技巧: 如图所示,这种小三角,不用图片,只用css怎么实现呢? 直接上代码吧: <!DOCTYPE html> <html> <head> <title>三角</title> <style> .main{width: 100px;border: 1px solid red;height: 100px;position: relative;} .box{width: 0;height: 0;border-style: soli

小技巧----随机背景颜色

#define COLOR_VALUE arc4random() % 256 /255.0//宏定义 @interface FirstViewController (){    NSTimer *_timer;}//定义一个事件的属性 [self createBackCorlor];//方法的调用 #pragma mark - 定时器方法- (void)createBackCorlor{    _timer = [NSTimer scheduledTimerWithTimeInterval:0.

解决浏览器窗口变小后右侧出现空白背景颜色或者图片不能全屏填充的方法

在做全屏网页的时候会出现这样的情况: 窗口最大化显示时正常,当缩小窗口时,出现了滚动条,将滚动条拖动到右侧就会出现空白,背景颜色都不显示但是元素还在例如下图: 全屏显示正常的,然后把窗口缩小 就会出现这样的效果,解决办法就是给body加一个最小高度,至于数值大小取决于网页的基本宽度,或者就是你导航元素占据的宽度(不是背景),就以此网页为例,网页主体1200px那么就在css中添加最小高度 body{ min-height:1200px; } 然后问题就解决了

Handler小例子,更换按钮的背景颜色

这几天一直在忙着开发一个新项目,写代码写得昏天黑地的,今天抽了几分钟时间写了下极简单的例子,改天有时间再写啦! 布局文件很简单,就一个Button: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/LinearLayout1

onenote小技巧-改变表格的背景颜色

2018年8月6日 16:53 一.表格的背景颜色: 如下: 日历 周一 周二 周三 操作步骤: 1.选中要改变颜色的行或列右键 2.选择"表格"->"底纹"->选择颜色,操作结束. 原文地址:https://www.cnblogs.com/pltang/p/9431471.html