一、實作如圖所示箭頭
<!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> .out{ width: 200px; height: 200px; background: #f00; position: relative; } .word{ position: absolute; left: 60px; line-height: 40px; } .triangle-out{ position: absolute; top: 0px; left: 0px; width: 0px; height: 0px; display: block; border-top: 20px solid #f00; border-right: 20px solid #f00; border-bottom: 20px solid #f00; border-left: 40px solid #ff0; } .triangle-in{ position: absolute; top: 0px; left: 0px; width: 0px; height: 0px; display: block; border-top: 20px solid transparent; border-right: 20px solid transparent; border-bottom: 20px solid transparent; border-left: 20px solid #f00; } </style> </head> <body> <p class="out"> <span class="triangle-out"></span> <span class="triangle-in"></span> <span class="word">read more</span> </p> </body> </html>
二、實作帶缺口提示框
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>带缺口的提示框-/</title> <style> .wrap{ font-size: 12px; margin:40px auto; width:600px; } .ui-slider-tooltip{ background:#FCFDFD; border:1px solid green; color:#222222; display: block; text-align: center; padding: 5px 3px 5px 3px; width: 190px; position: relative; } .ui-corner-all { -moz-border-radius-bottomleft:5px; -moz-border-radius-bottomright:5px; -moz-border-radius-topleft:5px; -moz-border-radius-topright:5px; -webkit-border-top-left-radius:5px 5px; -webkit-border-top-right-radius:5px 5px; -webkit-border-bottom-right-radius:5px 5px; -webkit-border-bottom-left-radius:5px 5px; } .ui-tooltip-pointer-down { border-bottom-width: 0; border-left: 7px dashed transparent; border-right: 7px dashed transparent; border-top: 8px solid green; bottom: -8px; display: block; height:0; left: 50%; margin-left: -7px; position: absolute; width:0; } .ui-tooltip-pointer-down-inner { border-left: 6px dashed transparent; border-right: 6px dashed transparent; border-top: 7px solid #fff; left: -6px; top: -9px; position: absolute; } .a{ display: block;width:0;height:0; border-left: 7px dashed transparent; border-right: 7px dashed transparent; border-top: 8px solid green; border-bottom: 0; position: absolute; } .b{ position: absolute; border-left: 6px dashed transparent; border-right: 6px dashed transparent; border-top: 7px solid #fff; top: -9px; left: -6px; } </style> </head> <body> <p class="wrap"> <h1 id="用CSS实现带缺口的提示框">用CSS实现带缺口的提示框</h1> <span class="a"> <span class="b"></span> </span> <br/> <span class="a"> <span class="b" style="top:-11px;"></span> </span> <br/> <span class="ui-slider-tooltip ui-corner-all"> <span>带缺口提示框</span> <span class="ui-tooltip-pointer-down"> <span class="ui-tooltip-pointer-down-inner" ></span> </span> </span> <br/> <span class="ui-slider-tooltip ui-corner-all" style="background: #f00"> <span>加个背景就可以看清原理啦</span> <span class="ui-tooltip-pointer-down"> <span class="ui-tooltip-pointer-down-inner" ></span> </span> </span> </p> </p> </body> </html>
其實就是利用寬度高度為0的box,設定border,得到想要的三角形,透過三角形的疊加顯示製作出箭頭的效果~
本文講解了css實現箭頭和帶缺口提示框,更多相關內容請關注php中文網。
相關推薦:
################################# ###關於物件導向設計的相關講解######的相關講解######以上是css實現箭頭和帶缺口提示框的詳細內容。更多資訊請關注PHP中文網其他相關文章!

在css中,可用list-style-type属性来去掉ul的圆点标记,语法为“ul{list-style-type:none}”;list-style-type属性可设置列表项标记的类型,当值为“none”可不定义标记,也可去除已有标记。

区别是:css是层叠样式表单,是将样式信息与网页内容分离的一种标记语言,主要用来设计网页的样式,还可以对网页各元素进行格式化;xml是可扩展标记语言,是一种数据存储语言,用于使用简单的标记描述数据,将文档分成许多部件并对这些部件加以标识。

在css中,可以利用cursor属性实现鼠标隐藏效果,该属性用于定义鼠标指针放在一个元素边界范围内时所用的光标形状,当属性值设置为none时,就可以实现鼠标隐藏效果,语法为“元素{cursor:none}”。

转换方法:1、给英文元素添加“text-transform: uppercase;”样式,可将所有的英文字母都变成大写;2、给英文元素添加“text-transform:capitalize;”样式,可将英文文本中每个单词的首字母变为大写。

在css中,rtl是“right-to-left”的缩写,是从右往左的意思,指的是内联内容从右往左依次排布,是direction属性的一个属性值;该属性规定了文本的方向和书写方向,语法为“元素{direction:rtl}”。

在css中,可以利用“font-style”属性设置i元素不是斜体样式,该属性用于指定文本的字体样式,当属性值设置为“normal”时,会显示元素的标准字体样式,语法为“i元素{font-style:normal}”。

在css3中,可以用“transform-origin”属性设置rotate的旋转中心点,该属性可更改转换元素的位置,第一个参数设置x轴的旋转位置,第二个参数设置y轴旋转位置,语法为“transform-origin:x轴位置 y轴位置”。


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

Safe Exam Browser
Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

SublimeText3 英文版
推薦:為Win版本,支援程式碼提示!

EditPlus 中文破解版
體積小,語法高亮,不支援程式碼提示功能

SublimeText3 Linux新版
SublimeText3 Linux最新版