CSS border 生成三角
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
div{ margin:20px 0 20px 20px;} .a{width:0; height:0; line-height:0; border-width:10px 10px; border-style:solid; border-color:#ff3300 #ff3300 #ffffff #ffffff;} .b{width:10px; height:10px; border:10px solid; border-color:#ff3300 #0000ff #339966 #00ff00;} .c{width:10px; height:10px; border:10px solid; border-color:#ff3300 #ffffff #ffffff #ffffff;} .d{width:0; height:0; border:10px solid; border-color:#ff3300 #ffffff #ffffff #ffffff;} .e{width:0; height:0; border-width:20px 10px; border-style:solid; border-color:#ff3300 #ffffff #ffffff #ffffff;} .f{width:0; height:0; line-height:0; border-width:20px 10px; border-style:solid; border-color:#ff3300 #ff3300 #ffffff #ffffff;} </style> </head> <body>
<div class="a"></div>
<div class="b"></div>
<div class="c"></div>
<div class="d"></div>
<div class="e"></div>
<div class="f"></div> </div> </body>
</html>
效果图:矩形框中依次渐变演示了最上面的那个图形的形成过程

css模拟圆角(适合边框和背景一样的圆角,对精密程度要求不高的)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
/*div{ margin:20px 0 20px 20px;}*/ .box{width:500px;}
.top{border-bottom:3px solid; border-top-color:#cc0000; border-bottom-color:#cc0000; border-left:3px dotted transparent; border-right:3px dotted transparent;}
.center{padding:10px 20px; color:white; font-size:14px; background:#cc0000;}
.bot{border-top:3px solid; border-top-color:#cc0000; border-bottom-color:#cccccc; border-left:3px dotted transparent; border-right:3px dotted transparent;} </style> </head> <body> <div class="box">
<div class="top"></div>
<div class="center">我是一只小小鸟、小小鸟!</div>
<div class="bot"></div>
</div> </div> </body>
</html>
效果图:

把div的边距拉大后会看的更清楚哦

改进:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.fl{ float:left;} .box{width:400px; margin:200px auto;}
.box .right .top{border-bottom:3px solid; border-top-color:#cc0000; border-bottom-color:#cc0000; border-left:3px dotted transparent; border-right:3px dotted transparent;}
.box .right .center{padding:100px 20px; color:white; font-size:14px; background:#cc0000;}
.box .right .bot{border-top:3px solid; border-top-color:#cc0000; border-bottom-color:#cccccc; border-left:3px dotted transparent; border-right:3px dotted transparent;} .box .left{ width:0; height:0; line-height:0; margin-top:20px; border-top:10px solid white; border-right:20px solid #cc0000; border-bottom:10px solid white; border-left:10px solid white;} </style> </head> <body> <div class="box">
<div class="left fl"></div>
<div class="right fl">
<div class="top"></div>
<div class="center">我是一只小小鸟、小小鸟!</div>
<div class="bot"></div>
</div>
<div style="clear:both;"></div>
</div> </div> </body>
</html>
效果图:

原文地址:http://www.zhangxinxu.com/wordpress/?p=794
CSS border 生成三角的更多相关文章
- 利用css中的border生成三角,兼容包括IE6的主流浏览器
1.生成四个不同颜色方向的梯形 #ladder{ width:20px; height:20px; border:10px solid; border-color:#ff3300 #0000ff #3 ...
- CSS border三角、圆角图形生成技术简介
http://www.zhangxinxu.com/wordpress/?p=794 一.前言 利用CSS的border属性可以生成一些图形,例如三角或是圆角.纯粹的CSS2的内容,没有兼容性的问题, ...
- css制作小三角
视觉稿中经常有些小三角,如下图.每次用图片做太不方便了,我们看看用css实现的效果(支持ie6,7哦) <style> /*border实现三角*/ /*箭头向上*/ .arrow-top ...
- div+css做出带三角的弹出框 和箭头
一.三角形 https://blog.csdn.net/Szu_AKer/article/details/51755821 notice:三角的那部分可以用图片作为背景,但是容易出现杂边.所以利用cs ...
- CSS之生成全屏背景图片
在CSS中背景图片的填充方法: background-position:x,y(背景图片x,y轴的定位) background-repeat:no-repeat(不平铺) background-rep ...
- CSS border边框属性教程(color style)
CSS 边框即CSS border-border边框样式颜色.边框样式.边框宽度的语法结构与应用案例教程篇 一.CSS 边框基础知识 CSS 边框即CSS border是控制对象的边框边线宽度.颜色. ...
- css border
CSS border用于设置HTML元素(如div)的边框,包括边框的宽度.颜色和样式.本文章向码农介绍CSS border边框属性详细内容,感兴趣的码农可以参考一下. CSS 边框即CSS bord ...
- border做三角符号
用border做三角符号以及其他图形 ;; border-width:20px 10px; border-style:solid; border-color:#ff3300 #ff3300 #ffff ...
- 【css样式生成 & 图片合并压缩工具】Sprite,你值得拥有
好久好久没有更新博客了,越来越懒...话说懒也有懒的好处,懒的时候你可能会想着用些神马方法来帮你偷懒.没错,下面就给大家介绍个博主前不久开发的[css样式生成 & 图片合并压缩工具]Spirt ...
随机推荐
- JavaScript设计模式与开发实践——读书笔记1.高阶函数(上)
说来惭愧,4个多月未更新了.4月份以后就开始忙起来了,论文.毕设.毕业旅行等七七八八的事情占据了很多时间,毕业之后开始忙碌的工作,这期间一直想写博客,但是一直没能静下心写.这段时间在看<Java ...
- 03-MyBatis主从实现代码读写分离应用以及实现
建立目录结构:
- PAT甲级1107. Social Clusters
PAT甲级1107. Social Clusters 题意: 当在社交网络上注册时,您总是被要求指定您的爱好,以便找到一些具有相同兴趣的潜在朋友.一个"社会群体"是一群拥有一些共同 ...
- asp.net连接LDAP数据,并从LDAP中取出相关数据(1)
ASP.NET连接LDAP数据库的有关信息 一.封装在DAL层中的获取用户信息的函数 /// <summary> /// 按照用户Id查找用户信息 /// </summary> ...
- UVA 10972 RevolC FaeLoN(边-双连通+缩点)
很好的一道图论题,整整撸了一上午... 题意是给定一个无向图,要求将所有边变为有向边,求最少加入多少条有向边,使得该图强连通?这里先假设一个问题:给定一个无向子图,该子图具有怎样的性质才能使得将其无向 ...
- LT1072 -- Wide-range voltage regulator automatically selects operating mode
The circuit in Figure 1 delivers programming voltages to an EEPROM under the control of an external ...
- The Struts dispatcher cannot be found. This is usually caused by using Struts ta
HTTP Status 500 - type Exception report message description The server encountered an internal error ...
- sql 锁类型与锁机制 转
SQL Server锁类型(SQL)收藏1. HOLDLOCK: 在该表上保持共享锁,直到整个事务结束,而不是在语句执行完立即释放所添加的锁. 2. NOLOCK:不添加共享锁和排它锁,当这个 ...
- LeetCode89:Gray Code
The gray code is a binary numeral system where two successive values differ in only one bit. Given a ...
- ODS与数据仓库
数据仓库是目前主要的数据存储体系.数据仓库之增W.H.Inmon认为,数据仓库是指支持管理决策过程的.面向主题的.集成的.随时间而变的.持久的数据的集合.简单地说,一个数据仓库就一个自数据库的商业应用 ...