为了照顾兼容性 低版本的形实现原浏览器,
一张图,形实现原不必做成图片或者字体图标。形实现原 你就知道 CSS 三角是形实现原怎么来的了, 做法如下:
div { width: 0; height: 0; border: 50px solid transparent; border-color: red green blue black; line-height:0; font-size: 0; }我们用css 边框可以模拟三角效果
宽度高度为0
我们4个边框都要写,加上 font-size: 0; line-height: 0;
效果图

<!DOCTYPE html><html><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>CSS 三角制作</title> <style> .box1 { width: 0; height: 0; /* border: 10px solid pink; */ border-top: 10px solid pink; border-right: 10px solid red; border-bottom: 10px solid blue; border-left: 10px solid green; } .box2 { width: 0; height: 0; border: 50px solid transparent; border-left-color: pink; margin: 100px auto; } .jd { position: relative; width: 120px; height: 249px; background-color: pink; } .jd span { position: absolute; right: 15px; top: -10px; width: 0; height: 0; /* 为了照顾兼容性 */ line-height: 0; font-size: 0; border: 5px solid transparent; border-bottom-color: pink; } </style></head><body> <div></div> <div></div> <div> <span></span> </div></body></html>使用 CSS 直接画出来就可以,形实现原网页中常见一些三角形,形实现原
相关文章:
5月1日启用新样式 @广东农业人抓紧换新!汉阴县涧池镇开展第二季度校园及周边环境安全联合大检查行动郑爽的16家公司不“爽”了 上海的两家工作室和九江的三家企业均已注销代表联络站:架起“连心桥”办好民生事汉阴8万余尾鲈鱼喜获丰收
0.4353s , 8186.859375 kb
Copyright © 2016 Powered by css三角形实现原理 其余的形实现原不能省略,答屿库问答社 sitemap