方案一

.x {
border: solid 1px red;
width: 100px;
height: 100px;
position: relative;
background-color: transparent;
} .x:before {
position: absolute;
top: 0px;
right:;
left:;
bottom:;
border-bottom: 100px solid red;
border-left: 100px solid transparent;
content: "";
} .x:after {
position: absolute;
left: 1px;
right:;
top: 1px;
bottom:;
border-bottom: 99px solid white;
border-left: 99px solid transparent;
content: "";
} .f {
border: solid 1px red;
width: 100px;
height: 100px;
position: relative;
background-color: transparent;
} .f:before {
position: absolute;
top: 0px;
right:;
left:;
bottom:;
border-bottom: 100px solid red;
border-right: 100px solid transparent;
content: "";
} .f:after {
position: absolute;
left:;
right: 1px;
top: 1px;
bottom:;
border-bottom: 99px solid white;
border-right: 99px solid transparent;
content: "";
}

x 是 斜线, f 是反斜线。

图:

附:CSS 图形:

css3激发想象/css3各种图形 http://www.cnblogs.com/wwcherish/archive/2012/09/18/2690336.html

CSS3机器猫: http://keleyi.com/keleyi/phtml/html5/3.htm

方案二

background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><line x1="0" y1="0" x2="100%" y2="100%" stroke="black" stroke-width="1"/></svg>');

css之 斜线的更多相关文章

  1. DIV+CSS制作斜线效果记录

    DIV+CSS 斜线效果很简单,只需设置一下CSS Border 的边框就能有斜线效果.代码分享给大家,你可以自己变通. 提示要注意两点:1.DIV宽高的定义.2.DIV在 IE6 中默认是有高度的. ...

  2. css画斜线(用于时间的显示)

  3. css划斜线

    http://stackoverflow.com/questions/18012420/draw-diagonal-lines-in-div-background-with-css

  4. 谈谈一些有趣的CSS题目(九)-- 巧妙的实现 CSS 斜线

    开本系列,谈谈一些有趣的 CSS 题目,题目类型天马行空,想到什么说什么,不仅为了拓宽一下解决问题的思路,更涉及一些容易忽视的 CSS 细节. 解题不考虑兼容性,题目天马行空,想到什么说什么,如果解题 ...

  5. 巧妙的实现 CSS 斜线(炫酷的小效果)

      开本系列,谈谈一些有趣的 CSS 题目,题目类型天马行空,想到什么说什么,不仅为了拓宽一下解决问题的思路,更涉及一些容易忽视的 CSS 细节. 解题不考虑兼容性,题目天马行空,想到什么说什么,如果 ...

  6. Matplotlib数据可视化(3):文本与轴

      在一幅图表中,文本.坐标轴和图像的是信息传递的核心,对着三者的设置是作图这最为关心的内容,在上一篇博客中虽然列举了一些设置方法,但没有进行深入介绍,本文以围绕如何对文本和坐标轴进行设置展开(对图像 ...

  7. css斜线

    斜线 .demo{ display: inline-block; width: 400px; height: 100px; resize: both; overflow: auto; margin-t ...

  8. CSS练习-导航栏斜线分隔-利用伪元素

    开始切第一张图了,第一个遇到的问题是顶部导航栏这里,用斜线分割.想到的思路是用伪类:before或者:after实现 先写html结构. <!-- 导航栏begin --> <div ...

  9. css实现栏目两边斜线的效果

    实现效果: 具体实现代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> ...

随机推荐

  1. 在Egret实现二维码长按识别

      Egret中二维码图片,是在canvas上,无法在微信上长按扫描识别. 由于微信长按识别二维码是截屏扫描原理,所以只要长按当前屏幕任意一张图片,都能够识别当前屏幕上的二维码. 这里把二维码放在ex ...

  2. zabbix3.0.4监控mysql主从同步

    zabbix3.0.4监控mysql主从同步 1.监控mysql主从同步原理: 执行一个命令 mysql -u zabbix -pzabbix -e 'show slave status\G' 我们在 ...

  3. 【227】◀▶ IDL 其他常用函数

    参考:Programming and Control Routines —— 编程和控制函数 01   N_ELEMENTS 表达式或者变量的元素个数. 02   DEFSYSV 定义系统变量. 03 ...

  4. [vivado系列]设置Xilinx Documention Navigator

    版本:2015.1 ------------------------------------------ 这是一个很便利FPGA工程师的文档整理收纳神器. 针对个人使用上的习惯,进行简单的2项设置. ...

  5. codeforce div 377

    #include <bits/stdc++.h> using namespace std; #define pb push_back #define lb lower_bound #def ...

  6. LINUX内核分析期末总结

    韩玉琪 + 原创作品转载请注明出处 + <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 一.课程总结 1 ...

  7. DataGridView控件“至少有一列没有单元格模板”问题处理

    这个问题一般是没有设置单元格模板造成的. mdgv.Columns[].CellTemplate = new DataGridViewTextBoxCell();

  8. Android支付之支付宝封装类

    今天介绍下在android中如何集成支付宝支付到自己的APP中去.让APP能够拥有方便,快捷的支付功能. 我们在做Android支付的时候肯定会用到支付宝支付,根据官方给出的demo做起来非常费劲,所 ...

  9. POJ 2398 - Toy Storage 点与直线位置关系

    Toy Storage Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5439   Accepted: 3234 Descr ...

  10. Xml文件操作的其中一个使用方法:

    XmlNodeList students = doc.DocumentElement.ChildNodes;//Student节点集合 foreach (XmlNode stu in students ...