国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > CSS > 正文

使用CSS繪制基礎(chǔ)的對話框圖案的代碼示例

2024-07-11 08:32:59
字體:
供稿:網(wǎng)友

如下圖:左側(cè)三角形
2016520120027789.png (186×110)

css代碼如下:

CSS Code復(fù)制內(nèi)容到剪貼板
  1. #talkbubble {        margin-left:30px;   
  2.    width: 120px;        height: 80px;    
  3.    background: red;       position: relative;   
  4.    -moz-border-radius:    10px;        -webkit-border-radius: 10px;    
  5.    border-radius:         10px;    }   
  6. #talkbubble:before {       content:"";   
  7.    position: absolute;       rightright: 100%;   
  8.    top: 26px;       width: 0;   
  9.    height: 0;       border-top: 13px solid transparent;   
  10.    border-right: 26px solid red;       border-bottom: 13px solid transparent;   
  11. }  

其實,本案例的精華就是三角形的繪制,那么如何繪制三角形呢?我在這里總結(jié)一下!

上三角形,上三角形,頂部是尖的,所以用border-left,border-right,和border-bottom可以實現(xiàn),給bottom一個顏色,其他設(shè)置為transparent

CSS Code復(fù)制內(nèi)容到剪貼板
  1. #triangle-up {        width: 0;   
  2.     height: 0;        border-left: 50px solid transparent;   
  3.     border-right: 50px solid transparent;        border-bottom: 100px solid red;   
  4. }  

同理,大家可以判斷一下如下代碼分別是什么樣的三角形!

CSS Code復(fù)制內(nèi)容到剪貼板
  1. #triangle-down {        width: 0;   
  2.     height: 0;        border-left: 50px solid transparent;   
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 霍州市| 天门市| 华宁县| 湖北省| 沾化县| 新兴县| 余江县| 安新县| 哈巴河县| 榕江县| 高雄市| 肥西县| 瑞安市| 仁怀市| 嘉义县| 凤庆县| 邹平县| 塘沽区| 玉门市| 巴青县| 平邑县| 正镶白旗| 科技| 寻甸| 永德县| 辽阳市| 延寿县| 措美县| 左贡县| 广河县| 抚宁县| 克东县| 清徐县| 二连浩特市| 柘荣县| 嵊泗县| 远安县| 镇巴县| 娱乐| 安达市| 丁青县|