test-css-tooltip.html 76 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344
  1. <!Doctype html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <meta property="qc:admins" content="465267610762567726375" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  7. <title>CSS 提示工具(Tooltip) | 菜鸟教程</title>
  8. <link rel='dns-prefetch' href='//s.w.org' />
  9. <link rel="canonical" href="http://www.runoob.com/css/css-tooltip.html" />
  10. <meta name="keywords" content="CSS 提示工具(Tooltip)">
  11. <meta name="description" content="CSS 提示工具(Tooltip) 本文我们为大家介绍如何使用 HTML 与 CSS 来创建提示工具。 提示工具在鼠标移动到指定元素后触发,先看以下四个实例: .tooltip { position: relative; display: inline-block; border-bottom: 1px dotted #ccc; zcursor: help; color: #006080; ..">
  12. <link rel="shortcut icon" href="//static.runoob.com/images/favicon.ico" mce_href="//static.runoob.com/images/favicon.ico" type="image/x-icon" >
  13. <link rel="stylesheet" href="/wp-content/themes/runoob/style.css?v=1.12" type="text/css" media="all" />
  14. <link rel="stylesheet" href="//cdn.bootcss.com/font-awesome/4.7.0/css/font-awesome.min.css" media="all" />
  15. <!--[if gte IE 9]><!-->
  16. <script src="//cdn.bootcss.com/jquery/2.0.3/jquery.min.js"></script>
  17. <!--<![endif]-->
  18. <!--[if lt IE 9]>
  19. <script src="//cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
  20. <script src="//cdn.bootcss.com/html5shiv/r29/html5.min.js"></script>
  21. <![endif]-->
  22. <link rel="apple-touch-icon" href="//static.runoob.com/images/icon/mobile-icon.png"/>
  23. <meta name="apple-mobile-web-app-title" content="菜鸟教程">
  24. </head>
  25. <body>
  26. <!-- 头部 -->
  27. <div class="container logo-search">
  28. <div class="col search row-search-mobile">
  29. <form action="index.php">
  30. <input class="placeholder" value="搜索……" name="s" autocomplete="off">
  31. </form>
  32. </div>
  33. <div class="row">
  34. <div class="col logo">
  35. <h1><a href="/">菜鸟教程 -- 学的不仅是技术,更是梦想!</a></h1>
  36. </div>
  37. <div class="col right-list">
  38. <button class="btn btn-responsive-nav btn-inverse" data-toggle="collapse" data-target=".nav-main-collapse" id="pull" style=""> <i class="fa fa-navicon"></i> </button>
  39. </div>
  40. <div class="col search search-desktop last">
  41. <form action="//www.runoob.com/" target="_blank">
  42. <input class="placeholder" id="s" name="s" value="搜索……" autocomplete="off">
  43. </form>
  44. </div>
  45. </div>
  46. </div>
  47. <!-- 导航栏 -->
  48. <!-- 导航栏 -->
  49. <div class="container navigation">
  50. <div class="row">
  51. <div class="col nav">
  52. <ul class="pc-nav">
  53. <li><a href="//www.runoob.com/">首页</a></li>
  54. <li><a href="/html/html-tutorial.html">HTML</a></li>
  55. <li><a href="/css/css-tutorial.html">CSS</a></li>
  56. <li><a href="/js/js-tutorial.html">JavaScript</a></li>
  57. <li><a href="/jquery/jquery-tutorial.html">jQuery</a></li>
  58. <li><a href="/bootstrap/bootstrap-tutorial.html">Bootstrap</a></li>
  59. <li><a href="/sql/sql-tutorial.html">SQL</a></li>
  60. <li><a href="/mysql/mysql-tutorial.html">MySQL</a></li>
  61. <li><a href="/php/php-tutorial.html">PHP</a></li>
  62. <li><a href="/python/python-tutorial.html">Python2</a></li>
  63. <li><a href="/python3/python3-tutorial.html">Python3</a></li>
  64. <li><a href="/cprogramming/c-tutorial.html">C</a></li>
  65. <li><a href="/cplusplus/cpp-tutorial.html">C++</a></li>
  66. <li><a href="/csharp/csharp-tutorial.html">C#</a></li>
  67. <li><a href="/java/java-tutorial.html">Java</a></li>
  68. <li><a href="/sitemap">更多……</a></li>
  69. <!--
  70. <li><a href="javascript:;" class="runoob-pop">登录</a></li>
  71. -->
  72. </ul>
  73. <ul class="mobile-nav">
  74. <li><a href="//www.runoob.com/">首页</a></li>
  75. <li><a href="/html/html-tutorial.html">HTML</a></li>
  76. <li><a href="/css/css-tutorial.html">CSS</a></li>
  77. <li><a href="/js/js-tutorial.html">JavaScript</a></li>
  78. <a href="javascript:void(0)" class="search-reveal">Search</a>
  79. </ul>
  80. </div>
  81. </div>
  82. </div><!-- 内容 -->
  83. <div class="container main">
  84. <!-- 中间 -->
  85. <div class="row">
  86. <div class="col left-column">
  87. <div class="tab">CSS 教程 <a data-cate="5" href="javascript:void(0);" title="夜间模式" id="moon"><i class="fa fa-moon-o" aria-hidden="true" style="font-size: 1.4em;float: right;margin: 4px 6px 0;"></i></a>
  88. <a data-cate="5" style="display:none;" href="javascript:void(0);" title="日间模式" id="sun" ><i class="fa fa-sun-o" aria-hidden="true" style="font-size: 1.4em;float: right;margin: 4px 6px 0;"></i></a>
  89. </div>
  90. <div class="sidebar-box gallery-list">
  91. <div class="design" id="leftcolumn">
  92. <a target="_top" title="CSS 教程" href="/css/css-tutorial.html" >
  93. CSS 教程 </a>
  94. <a target="_top" title="CSS 简介" href="/css/css-intro.html" >
  95. CSS 简介 </a>
  96. <a target="_top" title="CSS 语法" href="/css/css-syntax.html" >
  97. CSS 语法 </a>
  98. <a target="_top" title="CSS Id 和 Class选择器" href="/css/css-id-class.html" >
  99. CSS Id 和 Class选择器 </a>
  100. <a target="_top" title="CSS 创建" href="/css/css-howto.html" >
  101. CSS 创建 </a>
  102. <a target="_top" title="CSS Backgrounds(背景)" href="/css/css-background.html" >
  103. CSS Backgrounds(背景) </a>
  104. <a target="_top" title="CSS Text(文本)" href="/css/css-text.html" >
  105. CSS Text(文本) </a>
  106. <a target="_top" title="CSS Fonts(字体)" href="/css/css-font.html" >
  107. CSS Fonts(字体) </a>
  108. <a target="_top" title="CSS 链接(link)" href="/css/css-link.html" >
  109. CSS 链接(link) </a>
  110. <a target="_top" title="CSS 列表样式(ul)" href="/css/css-list.html" >
  111. CSS 列表样式(ul) </a>
  112. <a target="_top" title="CSS Table(表格)" href="/css/css-table.html" >
  113. CSS Table(表格) </a>
  114. <a target="_top" title="CSS 盒子模型" href="/css/css-boxmodel.html" >
  115. CSS 盒子模型 </a>
  116. <a target="_top" title="CSS Border(边框)" href="/css/css-border.html" >
  117. CSS Border(边框) </a>
  118. <a target="_top" title="CSS 轮廓(outline)属性" href="/css/css-outline.html" >
  119. CSS 轮廓(outline)属性 </a>
  120. <a target="_top" title="CSS Margin(外边距)" href="/css/css-margin.html" >
  121. CSS Margin(外边距) </a>
  122. <a target="_top" title="CSS Padding(填充)" href="/css/css-padding.html" >
  123. CSS Padding(填充) </a>
  124. <a target="_top" title="CSS 分组和嵌套" href="/css/css-grouping-nesting.html" >
  125. CSS 分组和嵌套 </a>
  126. <a target="_top" title="CSS 尺寸 (Dimension)" href="/css/css-dimension.html" >
  127. CSS 尺寸 (Dimension) </a>
  128. <a target="_top" title="CSS Display(显示) 与 Visibility(可见性)" href="/css/css-display-visibility.html" >
  129. CSS Display(显示) </a>
  130. <a target="_top" title="CSS Positioning(定位)" href="/css/css-positioning.html" >
  131. CSS Positioning(定位) </a>
  132. <a target="_top" title="CSS Float(浮动)" href="/css/css-float.html" >
  133. CSS Float(浮动) </a>
  134. <a target="_top" title="CSS 布局 &#8211; 水平 &#038; 垂直对齐" href="/css/css-align.html" >
  135. CSS 对齐 </a>
  136. <a target="_top" href="css-combinators.html">
  137. CSS 组合选择符 </a> <a target="_top" title="CSS 伪类" href="/css/css-pseudo-classes.html" >
  138. CSS 伪类 </a>
  139. <a target="_top" title="CSS 伪元素" href="/css/css-pseudo-elements.html" >
  140. CSS 伪元素 </a>
  141. <a target="_top" title="CSS 导航栏" href="/css/css-navbar.html" >
  142. CSS 导航栏 </a>
  143. <a target="_top" title="CSS 下拉菜单" href="css-dropdowns.html"> CSS 下拉菜单 </a>
  144. <a target="_top" title="CSS 提示工具(Tooltip)" href="css-tooltip.html"> CSS 提示工具</a> <a target="_top" title="CSS 图片廊" href="/css/css-image-gallery.html" >
  145. CSS 图片廊 </a>
  146. <a target="_top" title="CSS 图像透明/不透明" href="/css/css-image-transparency.html" >
  147. CSS 图像透明/不透明 </a>
  148. <a target="_top" title="CSS 图像拼合技术" href="/css/css-image-sprites.html" >
  149. CSS 图像拼合技术 </a>
  150. <a target="_top" title="CSS 媒体类型" href="/css/css-mediatypes.html" >
  151. CSS 媒体类型 </a>
  152. <a target="_top" title="CSS 属性选择器" href="/css/css-attribute-selectors.html" >
  153. CSS 属性选择器 </a>
  154. <a target="_top" title="CSS 总结" href="/css/css-summary.html" >
  155. CSS 总结 </a>
  156. <a target="_top" title="CSS 实例" href="/css/css-examples.html" >
  157. CSS 实例 </a>
  158. <br><h2 class="left"><span class="left_h2">CSS3</span> 教程</h2>
  159. <a target="_top" href="/css3/css3-tutorial.html" >
  160. CSS3 教程 </a>
  161. <a target="_top" href="/css3/css3-intro.html" >
  162. CSS3 简介 </a>
  163. <a target="_top" href="/css3/css3-borders.html" >
  164. CSS3 边框(Borders) </a>
  165. <a target="_top" href="/css3/css3-backgrounds.html" >
  166. CSS3 背景 </a>
  167. <a target="_top" href="/css3/css3-gradients.html">
  168. CSS3 渐变 </a>
  169. <a target="_top" href="/css3/css3-text-effects.html" >
  170. CSS3 文本效果 </a>
  171. <a target="_top" href="/css3/css3-fonts.html" >
  172. CSS3 字体 </a>
  173. <a target="_top" href="/css3/css3-2dtransforms.html" >
  174. CSS3 2D 转换 </a>
  175. <a target="_top" href="/css3/css3-3dtransforms.html" >
  176. CSS3 3D 转换 </a>
  177. <a target="_top" href="/css3/css3-transitions.html" >
  178. CSS3 过渡 </a>
  179. <a target="_top" href="/css3/css3-animations.html" >
  180. CSS3 动画 </a>
  181. <a target="_top" href="/css3/css3-multiple-columns.html" >
  182. CSS3 多列 </a>
  183. <a target="_top" href="/css3/css3-user-interface.html" >
  184. CSS3 用户界面 </a>
  185. <br>
  186. <h2 class="left"><span class="left_h2">CSS</span> 响应式设计</h2>
  187. <a target="_top" href="/css/css-rwd-viewport.html">Viewport</a>
  188. <a target="_top" href="/css/css-rwd-grid.html"> 网格视图</a>
  189. <a target="_top" href="/css/css-rwd-mediaqueries.html">媒体查询</a>
  190. <a target="_top" href="/css/css-rwd-images.html">图片</a>
  191. <a target="_top" href="/css/css-rwd-videos.html">视频(Video)</a>
  192. <a target="_top" href="/css/css-rwd-frameworks.html">框架</a>
  193. <br>
  194. <h2 class="left"><span class="left_h2">CSS</span> 参考手册</h2>
  195. <a target="_top" href="/cssref/css-reference.html" >CSS 参考手册</a>
  196. <a target="_top" href="/cssref/css-selectors.html">CSS 选择器</a>
  197. <a target="_top" href="/cssref/css-ref-aural.html">CSS 语音参考</a>
  198. <a target="_top" href="/cssref/css-websafe-fonts.html">CSS Web安全字体</a>
  199. <a target="_top" title="CSS 动画" href="/cssref/css-animatable.html"> CSS 动画 </a>
  200. <a target="_top" href="/cssref/css-units.html">CSS 单位</a>
  201. <a target="_top" href="/cssref/css-colors.html">CSS 颜色</a>
  202. <a target="_top" href="/cssref/css-colors-legal.html">CSS 颜色值</a>
  203. <a target="_top" href="/cssref/css-colornames.html">CSS 颜色名</a>
  204. <a target="_top" href="/cssref/css-colorsfull.html">CSS 十六进制颜色</a>
  205. </div>
  206. </div>
  207. </div> <div class="col middle-column">
  208. <div class="article">
  209. <div class="article-heading-ad">
  210. <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  211. <!-- 移动版 自动调整 -->
  212. <ins class="adsbygoogle"
  213. style="display:inline-block;min-width:300px;max-width:970px;width:100%;height:90px"
  214. data-ad-client="ca-pub-5751451760833794"
  215. data-ad-slot="1691338467"
  216. data-ad-format="horizontal"></ins>
  217. <script>
  218. (adsbygoogle = window.adsbygoogle || []).push({});
  219. </script>
  220. </div>
  221. <div class="previous-next-links">
  222. <div class="previous-design-link"><i style="font-size:16px;" class="fa fa-arrow-left" aria-hidden="true"></i> <a href="http://www.runoob.com/css/css-dropdowns.html" rel="prev"> CSS 下拉菜单</a> </div>
  223. <div class="next-design-link"></div>
  224. </div>
  225. <div class="article-body">
  226. <div class="article-intro" id="content">
  227. <h1>CSS 提示工具(Tooltip)
  228. </h1>
  229. <p>本文我们为大家介绍如何使用 HTML 与 CSS 来创建提示工具。</p>
  230. <p>提示工具在鼠标移动到指定元素后触发,先看以下四个实例:</p>
  231. <style>
  232. .tooltip {
  233. position: relative;
  234. display: inline-block;
  235. border-bottom: 1px dotted #ccc;
  236. zcursor: help;
  237. color: #006080;
  238. }
  239. .tooltip .tooltiptext {
  240. visibility: hidden;
  241. position: absolute;
  242. width: 120px;
  243. background-color: #555;
  244. color: #fff;
  245. text-align: center;
  246. padding: 5px 0;
  247. border-radius: 6px;
  248. z-index: 1;
  249. opacity: 0;
  250. transition: opacity .6s;
  251. }
  252. .tooltip:hover .tooltiptext {
  253. visibility: visible;
  254. opacity: 1;
  255. }
  256. .tooltip .tooltiptext2 {
  257. visibility: hidden;
  258. position: absolute;
  259. width: 120px;
  260. background-color: #555;
  261. color: #fff;
  262. text-align: center;
  263. padding: 5px 0;
  264. border-radius: 6px;
  265. z-index: 1;
  266. }
  267. .tooltip:hover .tooltiptext2 {
  268. visibility: visible;
  269. }
  270. .tooltip-right {
  271. top: -5px;
  272. left: 125%;
  273. }
  274. .tooltip-right2 {
  275. top: -5px;
  276. left: 105%;
  277. }
  278. .tooltip-right::after {
  279. content: "";
  280. position: absolute;
  281. top: 50%;
  282. right: 100%;
  283. margin-top: -5px;
  284. border-width: 5px;
  285. border-style: solid;
  286. border-color: transparent #555 transparent transparent;
  287. }
  288. .tooltip-bottom {
  289. top: 135%;
  290. left: 50%;
  291. margin-left: -60px;
  292. }
  293. .tooltip-bottom2 {
  294. top: 125%;
  295. left: 50%;
  296. margin-left: -60px;
  297. }
  298. .tooltip-bottom::after {
  299. content: "";
  300. position: absolute;
  301. bottom: 100%;
  302. left: 50%;
  303. margin-left: -5px;
  304. border-width: 5px;
  305. border-style: solid;
  306. border-color: transparent transparent #555 transparent;
  307. }
  308. .tooltip-top {
  309. bottom: 125%;
  310. left: 50%;
  311. margin-left: -60px;
  312. }
  313. .tooltip-top2 {
  314. bottom: 115%;
  315. left: 50%;
  316. margin-left: -60px;
  317. }
  318. .tooltip-top::after {
  319. content: "";
  320. position: absolute;
  321. top: 100%;
  322. left: 50%;
  323. margin-left: -5px;
  324. border-width: 5px;
  325. border-style: solid;
  326. border-color: #555 transparent transparent transparent;
  327. }
  328. .tooltip-left {
  329. top: -5px;
  330. bottom:auto;
  331. right: 128%;
  332. }
  333. .tooltip-left2 {
  334. top: -5px;
  335. bottom:auto;
  336. right: 105%;
  337. }
  338. .tooltip-left::after {
  339. content: "";
  340. position: absolute;
  341. top: 50%;
  342. left: 100%;
  343. margin-top: -5px;
  344. border-width: 5px;
  345. border-style: solid;
  346. border-color: transparent transparent transparent #555;
  347. }
  348. .tooltip .tooltiptext-bottomarrow {
  349. visibility: hidden;
  350. width: 120px;
  351. background-color: #111;
  352. color: #fff;
  353. text-align: center;
  354. border-radius: 6px;
  355. padding: 5px 0;
  356. position: absolute;
  357. z-index: 1;
  358. bottom: 130%;
  359. left: 50%;
  360. margin-left: -60px;
  361. }
  362. .tooltip .tooltiptext-bottomarrow::after {
  363. content: "";
  364. position: absolute;
  365. top: 100%;
  366. left: 50%;
  367. margin-left: -5px;
  368. border-width: 5px;
  369. border-style: solid;
  370. border-color: black transparent transparent transparent;
  371. }
  372. .tooltip:hover .tooltiptext-bottomarrow {
  373. visibility: visible;
  374. }
  375. .tooltip .tooltiptext-toparrow {
  376. visibility: hidden;
  377. width: 120px;
  378. background-color: #111;
  379. color: #fff;
  380. text-align: center;
  381. border-radius: 6px;
  382. padding: 5px 0;
  383. position: absolute;
  384. z-index: 1;
  385. top: 150%;
  386. left: 50%;
  387. margin-left: -60px;
  388. }
  389. .tooltip .tooltiptext-toparrow::after {
  390. content: "";
  391. position: absolute;
  392. bottom: 100%;
  393. left: 50%;
  394. margin-left: -5px;
  395. border-width: 5px;
  396. border-style: solid;
  397. border-color: transparent transparent black transparent;
  398. }
  399. .tooltip:hover .tooltiptext-toparrow {
  400. visibility: visible;
  401. }
  402. .tooltip .tooltiptext-leftarrow {
  403. visibility: hidden;
  404. width: 120px;
  405. background-color: #111;
  406. color: #fff;
  407. text-align: center;
  408. border-radius: 6px;
  409. padding: 5px 0;
  410. position: absolute;
  411. z-index: 1;
  412. top: -5px;
  413. left: 110%;
  414. }
  415. .tooltip .tooltiptext-leftarrow::after {
  416. content: "";
  417. position: absolute;
  418. top: 50%;
  419. right: 100%;
  420. margin-top: -5px;
  421. border-width: 5px;
  422. border-style: solid;
  423. border-color: transparent black transparent transparent;
  424. }
  425. .tooltip:hover .tooltiptext-leftarrow {
  426. visibility: visible;
  427. }
  428. .tooltip .tooltiptext-rightarrow {
  429. visibility: hidden;
  430. width: 120px;
  431. background-color: #111;
  432. color: #fff;
  433. text-align: center;
  434. border-radius: 6px;
  435. padding: 5px 0;
  436. position: absolute;
  437. z-index: 1;
  438. top: -5px;
  439. right: 110%;
  440. }
  441. .tooltip .tooltiptext-rightarrow::after {
  442. content: "";
  443. position: absolute;
  444. top: 50%;
  445. left: 100%;
  446. margin-top: -5px;
  447. border-width: 5px;
  448. border-style: solid;
  449. border-color: transparent transparent transparent black;
  450. }
  451. .tooltip:hover .tooltiptext-rightarrow {
  452. visibility: visible;
  453. }
  454. </style>
  455. <table class="reference">
  456. <tr><td>
  457. <div class="tooltip">头部显示
  458. <span class="tooltiptext tooltip-top">提示框文本</span>
  459. </div>
  460. </td><td>
  461. <div class="tooltip">右边显示
  462. <span class="tooltiptext tooltip-right">提示框文本</span>
  463. </div>
  464. </td><td>
  465. <div class="tooltip">底部显示
  466. <span class="tooltiptext tooltip-bottom">提示框文本</span>
  467. </div>
  468. </td><td>
  469. <div class="tooltip">左边显示
  470. <span class="tooltiptext tooltip-left">提示框文本</span>
  471. </div>
  472. </td></tr></table>
  473. <hr>
  474. <h2>基础提示框(Tooltip)</h2>
  475. <p>提示框在鼠标移动到指定元素上显示:</p>
  476. <div class="example">
  477. <h2 class="example">HTML 代码:</h2>
  478. <div class="example_code">
  479. <div class="hl-main"><span class="hl-brackets">&lt;</span><span class="hl-reserved">style</span><span class="hl-brackets">&gt;</span></div><div class="hl-main"><span class="hl-comment">/*</span><span class="hl-comment"> Tooltip 容器 </span><span class="hl-comment">*/</span><span class="hl-code">
  480. </span><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  481. </span><span class="hl-reserved">position:</span><span class="hl-code"> </span><span class="hl-string">relative</span><span class="hl-reserved"></span><span class="hl-code">;
  482. </span><span class="hl-reserved">display:</span><span class="hl-code"> </span><span class="hl-string">inline-block</span><span class="hl-reserved"></span><span class="hl-code">;
  483. </span><span class="hl-reserved">border-bottom:</span><span class="hl-code"> </span><span class="hl-number">1</span><span class="hl-string">px</span><span class="hl-code"> </span><span class="hl-string">dotted</span><span class="hl-code"> </span><span class="hl-var">black</span><span class="hl-reserved"></span><span class="hl-code">; </span><span class="hl-comment">/*</span><span class="hl-comment"> 悬停元素上显示点线 </span><span class="hl-comment">*/</span><span class="hl-code">
  484. </span><span class="hl-brackets">}</span><span class="hl-code">
  485. </span><span class="hl-comment">/*</span><span class="hl-comment"> Tooltip 文本 </span><span class="hl-comment">*/</span><span class="hl-code">
  486. </span><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  487. </span><span class="hl-reserved">visibility:</span><span class="hl-code"> </span><span class="hl-string">hidden</span><span class="hl-reserved"></span><span class="hl-code">;
  488. </span><span class="hl-reserved">width:</span><span class="hl-code"> </span><span class="hl-number">120</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  489. </span><span class="hl-reserved">background-color:</span><span class="hl-code"> </span><span class="hl-var">black</span><span class="hl-reserved"></span><span class="hl-code">;
  490. </span><span class="hl-reserved">color:</span><span class="hl-code"> </span><span class="hl-var">#fff</span><span class="hl-reserved"></span><span class="hl-code">;
  491. </span><span class="hl-reserved">text-align:</span><span class="hl-code"> </span><span class="hl-string">center</span><span class="hl-reserved"></span><span class="hl-code">;
  492. </span><span class="hl-reserved">padding:</span><span class="hl-code"> </span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-code"> </span><span class="hl-number">0</span><span class="hl-reserved"></span><span class="hl-code">;
  493. </span><span class="hl-reserved">border-radius:</span><span class="hl-code"> </span><span class="hl-number">6</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  494. </span><span class="hl-comment">/*</span><span class="hl-comment"> 定位 </span><span class="hl-comment">*/</span><span class="hl-code">
  495. </span><span class="hl-reserved">position:</span><span class="hl-code"> </span><span class="hl-string">absolute</span><span class="hl-reserved"></span><span class="hl-code">;
  496. </span><span class="hl-reserved">z-index:</span><span class="hl-code"> </span><span class="hl-number">1</span><span class="hl-reserved"></span><span class="hl-code">;
  497. </span><span class="hl-brackets">}</span><span class="hl-code">
  498. </span><span class="hl-comment">/*</span><span class="hl-comment"> 鼠标移动上去后显示提示框 </span><span class="hl-comment">*/</span><span class="hl-code">
  499. </span><span class="hl-identifier">.tooltip</span><span class="hl-special">:hover</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  500. </span><span class="hl-reserved">visibility:</span><span class="hl-code"> </span><span class="hl-string">visible</span><span class="hl-reserved"></span><span class="hl-code">;
  501. </span><span class="hl-brackets">}</span></div><div class="hl-main"><span class="hl-brackets">&lt;/</span><span class="hl-reserved">style</span><span class="hl-brackets">&gt;</span><span class="hl-code">
  502. </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">div</span><span class="hl-code"> </span><span class="hl-var">class</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">tooltip</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-code">鼠标移动到这
  503. </span><span class="hl-brackets">&lt;</span><span class="hl-reserved">span</span><span class="hl-code"> </span><span class="hl-var">class</span><span class="hl-code">=</span><span class="hl-quotes">&quot;</span><span class="hl-string">tooltiptext</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">&gt;</span><span class="hl-code">提示文本</span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">span</span><span class="hl-brackets">&gt;</span><span class="hl-code">
  504. </span><span class="hl-brackets">&lt;/</span><span class="hl-reserved">div</span><span class="hl-brackets">&gt;</span></div>
  505. </div>
  506. <br>
  507. <a target="_blank" href="/try/try.php?filename=trycss_tooltip" class="tryitbtn">尝试一下 »</a>
  508. </div>
  509. <h3>实例解析</h3>
  510. <p><strong>HTML)</strong> 使用容器元素 (like &lt;div&gt;) 并添加
  511. <b>"tooltip"</b> 类。在鼠标移动到 &lt;div&gt; 上时显示提示信息。</p>
  512. <p>提示文本放在内联函数上(如 &lt;span&gt;) 并使用<b>class="tooltiptext"</b>。</p>
  513. <p><strong>CSS)</strong><b>tooltip</b> 类使用 <b>position:relative</b>, 提示文本需要设置定位值 <b>position:absolute</b>。
  514. <strong>注意: </strong> 接下来的实例会显示更多的定位效果。</p>
  515. <p><b>tooltiptext</b> 类用于实际的提示文本。模式是隐藏的,在鼠标移动到元素显示 。设置了一些宽度、背景色、字体色等样式。
  516. </p>
  517. <p>CSS3 <b>border-radius</b> 属性用于为提示框添加圆角。</p>
  518. <p><b>:hover</b> 选择器用于在鼠标移动到到指定元素 &lt;div&gt; 上时显示的提示。</p>
  519. <hr>
  520. <h2>定位提示工具</h2>
  521. <p>以下实例中,提示工具显示在指定元素的右侧(<b>left:105%</b>) 。</p><p>
  522. 注意 <b>top:-5px</b> 同于定位在容器元素的中间。使用数字 <strong>5</strong> 因为提示文本的顶部和底部的内边距(padding)是 5px。
  523. </p><p>
  524. 如果你修改 padding 的值,top 值也要对应修改,这样才可以确保它是居中对齐的。</p><p>在提示框显示在左边的情况也是这个原理。</p>
  525. <div class="example">
  526. <h2 class="example">显示在右侧:</h2>
  527. <div class="example_code">
  528. <div class="hl-main"><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  529. </span><span class="hl-reserved">top:</span><span class="hl-code"> -</span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  530. </span><span class="hl-reserved">left:</span><span class="hl-code"> </span><span class="hl-number">105</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
  531. </span><span class="hl-brackets">}</span></div>
  532. </div>
  533. <br>
  534. <a target="_blank" href="/try/try.php?filename=trycss_tooltip_right" class="tryitbtn">尝试一下 »</a>
  535. </div><br>
  536. <div class="example">
  537. <h2 class="example">显示在左侧:</h2>
  538. <div class="example_code">
  539. <div class="hl-main"><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  540. </span><span class="hl-reserved">top:</span><span class="hl-code"> -</span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  541. </span><span class="hl-reserved">right:</span><span class="hl-code"> </span><span class="hl-number">105</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
  542. </span><span class="hl-brackets">}</span></div>
  543. </div>
  544. <br>
  545. <a target="_blank" href="/try/try.php?filename=trycss_tooltip_left" class="tryitbtn">尝试一下 »</a>
  546. </div>
  547. <p>如果你想要提示工具显示在头部和底部。我们需要使用 <b>margin-left</b> 属性,并设置为 -60px。
  548. 这个数字计算来源是使用宽度的一半来居中对齐,即: width/2 (120/2 = 60)。</p>
  549. <div class="example">
  550. <h2 class="example">显示在头部:</h2>
  551. <div class="example_code">
  552. <div class="hl-main"><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  553. </span><span class="hl-reserved">width:</span><span class="hl-code"> </span><span class="hl-number">120</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  554. </span><span class="hl-reserved">bottom:</span><span class="hl-code"> </span><span class="hl-number">100</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
  555. </span><span class="hl-reserved">left:</span><span class="hl-code"> </span><span class="hl-number">50</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
  556. </span><span class="hl-reserved">margin-left:</span><span class="hl-code"> -</span><span class="hl-number">60</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">; </span><span class="hl-comment">/*</span><span class="hl-comment"> 使用一半宽度 (120/2 = 60) 来居中提示工具 </span><span class="hl-comment">*/</span><span class="hl-code">
  557. </span><span class="hl-brackets">}</span></div>
  558. </div>
  559. <br>
  560. <a target="_blank" href="/try/try.php?filename=trycss_tooltip_top" class="tryitbtn">尝试一下 »</a>
  561. </div>
  562. <br>
  563. <div class="example">
  564. <h2 class="example">显示在底部:</h2>
  565. <div class="example_code">
  566. <div class="hl-main"><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  567. </span><span class="hl-reserved">width:</span><span class="hl-code"> </span><span class="hl-number">120</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  568. </span><span class="hl-reserved">top:</span><span class="hl-code"> </span><span class="hl-number">100</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
  569. </span><span class="hl-reserved">left:</span><span class="hl-code"> </span><span class="hl-number">50</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
  570. </span><span class="hl-reserved">margin-left:</span><span class="hl-code"> -</span><span class="hl-number">60</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">; </span><span class="hl-comment">/*</span><span class="hl-comment"> 使用一半宽度 (120/2 = 60) 来居中提示工具 </span><span class="hl-comment">*/</span><span class="hl-code">
  571. </span><span class="hl-brackets">}</span></div>
  572. </div>
  573. <br>
  574. <a target="_blank" href="/try/try.php?filename=trycss_tooltip_bottom" class="tryitbtn">尝试一下 »</a>
  575. </div>
  576. <hr>
  577. <h2>添加箭头</h2>
  578. <p>我们可以用CSS 伪元素 ::after 及 content 属性为提示工具创建一个小箭头标志,箭头是由边框组成的,但组合起来后提示工具像个语音信息框。</p>
  579. <p>以下实例演示了如何为显示在顶部的提示工具添加底部箭头:</p>
  580. <div class="example">
  581. <h2 class="example">顶部提示框/底部箭头:</h2>
  582. <div class="example_code">
  583. <div class="hl-main"><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code">:</span><span class="hl-special">:after</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  584. </span><span class="hl-reserved">content:</span><span class="hl-code"> &quot; &quot;</span><span class="hl-reserved"></span><span class="hl-code">;
  585. </span><span class="hl-reserved">position:</span><span class="hl-code"> </span><span class="hl-string">absolute</span><span class="hl-reserved"></span><span class="hl-code">;
  586. </span><span class="hl-reserved">top:</span><span class="hl-code"> </span><span class="hl-number">100</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">; </span><span class="hl-comment">/*</span><span class="hl-comment"> 提示工具底部 </span><span class="hl-comment">*/</span><span class="hl-code">
  587. </span><span class="hl-reserved">left:</span><span class="hl-code"> </span><span class="hl-number">50</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
  588. </span><span class="hl-reserved">margin-left:</span><span class="hl-code"> -</span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  589. </span><span class="hl-reserved">border-width:</span><span class="hl-code"> </span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  590. </span><span class="hl-reserved">border-style:</span><span class="hl-code"> </span><span class="hl-string">solid</span><span class="hl-reserved"></span><span class="hl-code">;
  591. </span><span class="hl-reserved">border-color:</span><span class="hl-code"> </span><span class="hl-var">black</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-reserved"></span><span class="hl-code">;
  592. </span><span class="hl-brackets">}</span></div>
  593. </div>
  594. <br>
  595. <a target="_blank" href="/try/try.php?filename=trycss_tooltip_arrow_bottom" class="tryitbtn">尝试一下 »</a>
  596. </div>
  597. <h3>实例解析</h3>
  598. <p>在提示工具内定位箭头: <b>top: 100%</b> , 箭头将显示在提示工具的底部。<b>left: 50%</b> 用于居中对齐箭头。</p>
  599. <p><strong>注意:</strong><b>border-width</b> 属性指定了箭头的大小。如果你修改它,也要修改 <b>margin-left</b> 值。这样箭头在能居中显示。</p>
  600. <p><b>border-color</b> 用于将内容转换为箭头。设置顶部边框为黑色,其他是透明的。如果设置了其他的也是黑色则会显示为一个黑色的四边形。</p>
  601. <p>以下实例演示了如何在提示工具的头部添加箭头,注意设置边框颜色:</p>
  602. <div class="example">
  603. <h2 class="example">底部提示框/顶部箭头:</h2>
  604. <div class="example_code">
  605. <div class="hl-main"><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code">:</span><span class="hl-special">:after</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  606. </span><span class="hl-reserved">content:</span><span class="hl-code"> &quot; &quot;</span><span class="hl-reserved"></span><span class="hl-code">;
  607. </span><span class="hl-reserved">position:</span><span class="hl-code"> </span><span class="hl-string">absolute</span><span class="hl-reserved"></span><span class="hl-code">;
  608. </span><span class="hl-reserved">bottom:</span><span class="hl-code"> </span><span class="hl-number">100</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">; </span><span class="hl-comment">/*</span><span class="hl-comment"> 提示工具头部 </span><span class="hl-comment">*/</span><span class="hl-code">
  609. </span><span class="hl-reserved">left:</span><span class="hl-code"> </span><span class="hl-number">50</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
  610. </span><span class="hl-reserved">margin-left:</span><span class="hl-code"> -</span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  611. </span><span class="hl-reserved">border-width:</span><span class="hl-code"> </span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  612. </span><span class="hl-reserved">border-style:</span><span class="hl-code"> </span><span class="hl-string">solid</span><span class="hl-reserved"></span><span class="hl-code">;
  613. </span><span class="hl-reserved">border-color:</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-code"> </span><span class="hl-var">black</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-reserved"></span><span class="hl-code">;
  614. </span><span class="hl-brackets">}</span></div>
  615. </div>
  616. <br>
  617. <a target="_blank" href="/try/try.php?filename=trycss_tooltip_arrow_top" class="tryitbtn">尝试一下 »</a>
  618. </div>
  619. <p>以下两个实例是左右两边的箭头实例:</p>
  620. <div class="example">
  621. <h2 class="example">右侧提示框/左侧箭头:</h2>
  622. <div class="example_code">
  623. <div class="hl-main"><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code">:</span><span class="hl-special">:after</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  624. </span><span class="hl-reserved">content:</span><span class="hl-code"> &quot; &quot;</span><span class="hl-reserved"></span><span class="hl-code">;
  625. </span><span class="hl-reserved">position:</span><span class="hl-code"> </span><span class="hl-string">absolute</span><span class="hl-reserved"></span><span class="hl-code">;
  626. </span><span class="hl-reserved">top:</span><span class="hl-code"> </span><span class="hl-number">50</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
  627. </span><span class="hl-reserved">right:</span><span class="hl-code"> </span><span class="hl-number">100</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">; </span><span class="hl-comment">/*</span><span class="hl-comment"> 提示工具左侧 </span><span class="hl-comment">*/</span><span class="hl-code">
  628. </span><span class="hl-reserved">margin-top:</span><span class="hl-code"> -</span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  629. </span><span class="hl-reserved">border-width:</span><span class="hl-code"> </span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  630. </span><span class="hl-reserved">border-style:</span><span class="hl-code"> </span><span class="hl-string">solid</span><span class="hl-reserved"></span><span class="hl-code">;
  631. </span><span class="hl-reserved">border-color:</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-code"> </span><span class="hl-var">black</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-reserved"></span><span class="hl-code">;
  632. </span><span class="hl-brackets">}</span></div>
  633. </div>
  634. <br>
  635. <a target="_blank" href="/try/try.php?filename=trycss_tooltip_arrow_left" class="tryitbtn">尝试一下 »</a>
  636. </div>
  637. <br>
  638. <div class="example">
  639. <h2 class="example">左侧提示框/右侧箭头:</h2>
  640. <div class="example_code">
  641. <div class="hl-main"><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code">:</span><span class="hl-special">:after</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  642. </span><span class="hl-reserved">content:</span><span class="hl-code"> &quot; &quot;</span><span class="hl-reserved"></span><span class="hl-code">;
  643. </span><span class="hl-reserved">position:</span><span class="hl-code"> </span><span class="hl-string">absolute</span><span class="hl-reserved"></span><span class="hl-code">;
  644. </span><span class="hl-reserved">top:</span><span class="hl-code"> </span><span class="hl-number">50</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">;
  645. </span><span class="hl-reserved">left:</span><span class="hl-code"> </span><span class="hl-number">100</span><span class="hl-string">%</span><span class="hl-reserved"></span><span class="hl-code">; </span><span class="hl-comment">/*</span><span class="hl-comment"> 提示工具右侧 </span><span class="hl-comment">*/</span><span class="hl-code">
  646. </span><span class="hl-reserved">margin-top:</span><span class="hl-code"> -</span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  647. </span><span class="hl-reserved">border-width:</span><span class="hl-code"> </span><span class="hl-number">5</span><span class="hl-string">px</span><span class="hl-reserved"></span><span class="hl-code">;
  648. </span><span class="hl-reserved">border-style:</span><span class="hl-code"> </span><span class="hl-string">solid</span><span class="hl-reserved"></span><span class="hl-code">;
  649. </span><span class="hl-reserved">border-color:</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-code"> </span><span class="hl-string">transparent</span><span class="hl-code"> </span><span class="hl-var">black</span><span class="hl-reserved"></span><span class="hl-code">;
  650. </span><span class="hl-brackets">}</span></div>
  651. </div>
  652. <br>
  653. <a target="_blank" href="/try/try.php?filename=trycss_tooltip_arrow_right" class="tryitbtn">尝试一下 »</a>
  654. </div>
  655. <hr>
  656. <h2>淡入效果</h2>
  657. <p>我们可以使用 CSS3 transition 属性及 opacity 属性来实现提示工具的淡入效果:</p>
  658. <div class="example">
  659. <h2 class="example">左侧提示框/右侧箭头:</h2>
  660. <div class="example_code">
  661. <div class="hl-main"><span class="hl-identifier">.tooltip</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  662. </span><span class="hl-reserved">opacity:</span><span class="hl-code"> </span><span class="hl-number">0</span><span class="hl-reserved"></span><span class="hl-code">;
  663. </span><span class="hl-reserved">transition:</span><span class="hl-code"> </span><span class="hl-code">opacity</span><span class="hl-code"> </span><span class="hl-number">1</span><span class="hl-code">s</span><span class="hl-reserved"></span><span class="hl-code">;
  664. </span><span class="hl-brackets">}</span><span class="hl-code">
  665. </span><span class="hl-identifier">.tooltip</span><span class="hl-special">:hover</span><span class="hl-code"> </span><span class="hl-identifier">.tooltiptext</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code">
  666. </span><span class="hl-reserved">opacity:</span><span class="hl-code"> </span><span class="hl-number">1</span><span class="hl-reserved"></span><span class="hl-code">;
  667. </span><span class="hl-brackets">}</span></div>
  668. </div>
  669. <br>
  670. <a target="_blank" href="/try/try.php?filename=trycss_tooltip_transition" class="tryitbtn">尝试一下 »</a>
  671. </div>
  672. <hr>
  673. <h2>更多实例</h2>
  674. <p><a href="https://c.runoob.com/codedemo/2747" target="_blank">漂亮的 CSS 提示框</a></p>
  675. </div>
  676. </div>
  677. <div class="previous-next-links">
  678. <div class="previous-design-link"><i style="font-size:16px;" class="fa fa-arrow-left" aria-hidden="true"></i> <a href="http://www.runoob.com/css/css-dropdowns.html" rel="prev"> CSS 下拉菜单</a> </div>
  679. <div class="next-design-link"></div>
  680. </div>
  681. <!-- 笔记列表 -->
  682. <style>
  683. .wrapper {
  684. /*text-transform: uppercase; */
  685. background: #ececec;
  686. color: #555;
  687. cursor: help;
  688. font-family: "Gill Sans", Impact, sans-serif;
  689. font-size: 20px;
  690. position: relative;
  691. text-align: center;
  692. width: 200px;
  693. -webkit-transform: translateZ(0); /* webkit flicker fix */
  694. -webkit-font-smoothing: antialiased; /* webkit text rendering fix */
  695. }
  696. .wrapper .tooltip {
  697. white-space: nowrap;
  698. font-size: 14px;
  699. text-align: left;
  700. background: #96b97d;
  701. bottom: 100%;
  702. color: #fff;
  703. display: block;
  704. left: -25px;
  705. margin-bottom: 15px;
  706. opacity: 0;
  707. padding: 14px;
  708. pointer-events: none;
  709. position: absolute;
  710. -webkit-transform: translateY(10px);
  711. -moz-transform: translateY(10px);
  712. -ms-transform: translateY(10px);
  713. -o-transform: translateY(10px);
  714. transform: translateY(10px);
  715. -webkit-transition: all .25s ease-out;
  716. -moz-transition: all .25s ease-out;
  717. -ms-transition: all .25s ease-out;
  718. -o-transition: all .25s ease-out;
  719. transition: all .25s ease-out;
  720. -webkit-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
  721. -moz-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
  722. -ms-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
  723. -o-box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
  724. box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.28);
  725. }
  726. .tooltip a {
  727. color:#fff;
  728. }
  729. /* This bridges the gap so you can mouse into the tooltip without it disappearing */
  730. .wrapper .tooltip:before {
  731. bottom: -20px;
  732. content: " ";
  733. display: block;
  734. height: 20px;
  735. left: 0;
  736. position: absolute;
  737. width: 100%;
  738. }
  739. /* CSS Triangles - see Trevor's post */
  740. .wrapper .tooltip:after {
  741. border-left: solid transparent 10px;
  742. border-right: solid transparent 10px;
  743. border-top: solid #96b97d 10px;
  744. bottom: -10px;
  745. content: " ";
  746. height: 0;
  747. left: 20%;
  748. margin-left: -13px;
  749. position: absolute;
  750. width: 0;
  751. }
  752. .wrapper .tooltip1 {
  753. margin-left: 50px;
  754. padding-top: 0px;
  755. }
  756. .wrapper:hover .tooltip {
  757. opacity: 1;
  758. pointer-events: auto;
  759. -webkit-transform: translateY(0px);
  760. -moz-transform: translateY(0px);
  761. -ms-transform: translateY(0px);
  762. -o-transform: translateY(0px);
  763. transform: translateY(0px);
  764. }
  765. /* IE can just show/hide with no transition */
  766. .lte8 .wrapper .tooltip {
  767. display: none;
  768. }
  769. .lte8 .wrapper:hover .tooltip {
  770. display: block;
  771. }
  772. </style>
  773. <div id="respond" class="no_webshot">
  774. <div class="comment-signarea" style="">
  775. <h3 class="text-muted" id="share_code"><i class="fa fa-pencil-square-o" aria-hidden="true"></i> 点我分享笔记</h3>
  776. <input type="hidden" name="is_user_logged_in" id="is_user_logged_in" value="0">
  777. <p style="font-size:14px;">笔记需要是本篇文章的内容扩展!</p>
  778. <p style="font-size:14px;"><a href="/w3cnote/runoob-user-test-intro.html#invite" target="_blank">注册邀请码获取方式</a></p>
  779. <!--<h3 class="text-muted"><i class="fa fa-info-circle" aria-hidden="true"></i> 分享笔记前必须<a href="javascript:;" class="runoob-pop">登录</a>!</h3>
  780. <p><a href="/w3cnote/runoob-user-test-intro.html#invite" target="_blank">注册邀请码获取方式</a></p>-->
  781. </div>
  782. <form action="/wp-content/themes/runoob/option/addnote.php" method="post" id="commentform" style="display:none;">
  783. <div class="comt">
  784. <div class="comt-title">
  785. <i style="font-size:36px;" class="fa fa-user-circle" aria-hidden="true"></i> <p><a id="cancel-comment-reply-link" href="javascript:;">取消</a></p>
  786. </div>
  787. <div class="comt-box">
  788. <div id="mded"></div>
  789. <div class="comt-ctrl">
  790. <div class="comt-tips"><input type='hidden' name='comment_post_ID' value='18450' id='comment_post_ID' />
  791. <input type='hidden' name='comment_parent' id='comment_parent' value='0' />
  792. </div>
  793. <button type="submit" name="submit" id="submit" tabindex="5"><i class="fa fa-pencil" aria-hidden="true"></i> 分享笔记</button>
  794. </div>
  795. </div>
  796. <div class="comt-comterinfo">
  797. <ul id="comment-author-info">
  798. <li class="form-inline"><label class="hide" for="author">昵称</label><input class="ipt" type="text" name="author" id="author" value="" tabindex="2" placeholder="昵称"><span class="text-muted">昵称 (必填)</span></li>
  799. <li class="form-inline"><label class="hide" for="email">邮箱</label><input class="ipt" type="text" name="email" id="email" value="" tabindex="3" placeholder="邮箱"><span class="text-muted">邮箱 (必填)</span></li>
  800. <li class="form-inline"><label class="hide" for="url">引用地址</label><input class="ipt" type="text" name="url" id="url" value="" tabindex="4" placeholder="引用地址"><span class="text-muted">引用地址</span></li>
  801. </ul>
  802. </div>
  803. </div>
  804. </form>
  805. </div>
  806. <script type="text/javascript">
  807. $(function() {
  808. //初始化编辑器
  809. var editor = new Simditor({
  810. textarea: $('#mded'),
  811. placeholder: '写笔记...',
  812. upload: false,
  813. defaultImage: 'http://www.runoob.com/images/logo.png',
  814. codeLanguages: '',
  815. toolbar: [ 'bold','code','ul','ol','image' ]
  816. });
  817. editor.on('selectionchanged', function() {
  818. $(".code-popover").hide();
  819. });
  820. // 提交数据
  821. $("#share_code").click(function() {
  822. $(".comment-signarea").hide();
  823. $("#commentform").show();
  824. });
  825. // 提交笔记
  826. var commentform=$('#commentform');
  827. commentform.prepend('<div id="comment-status" ></div>');
  828. var statusdiv=$('#comment-status');
  829. commentform.submit(function(e){
  830. e.preventDefault();
  831. var noteContent = editor.getValue();
  832. // console.log(noteContent);
  833. noteContent = noteContent.replace(/<pre><code>/g,"<pre>");
  834. noteContent = noteContent.replace(/<\/code><\/pre>/g,"</pre>");
  835. // 系列化表单数据
  836. var comment_parent = 0;
  837. var is_user_logged_in = $("#is_user_logged_in").val();
  838. var comment_post_ID = 18450;
  839. var _wp_unfiltered_html_comment = $("#_wp_unfiltered_html_comment").val();
  840. var comment = noteContent;
  841. var author = $("#author").val();
  842. var url = $("#url").val();
  843. var email = $("#email").val();
  844. if(isBlank(author) && is_user_logged_in==0) {
  845. statusdiv.html('<p class="ajax-error">请输入昵称!</p>');
  846. } else if(isBlank(email) && is_user_logged_in==0) {
  847. statusdiv.html('<p class="ajax-error">请输入邮箱!</p>');
  848. } else {
  849. // var formdata=commentform.serialize() + "&comment=" + noteContent ;
  850. // 添加状态信息
  851. statusdiv.html('<p>Processing...</p>');
  852. // 获取表单提交地址
  853. var formurl=commentform.attr('action');
  854. // 异步提交
  855. $.ajax({
  856. type: 'post',
  857. url: formurl,
  858. dataType:'json',
  859. data: {"comment_parent":comment_parent,"comment_post_ID":comment_post_ID, "_wp_unfiltered_html_comment":_wp_unfiltered_html_comment,"comment":comment,"url":url, "email":email,"author":author},
  860. error: function(XMLHttpRequest, textStatus, errorThrown){
  861. statusdiv.html('<p class="ajax-error" >数据不完整或表单提交太快了!</p>');
  862. },
  863. success: function(data, textStatus){
  864. if(data.errorno=="0") {
  865. $("#submit").prop('disabled', true);
  866. statusdiv.html('<p class="ajax-success" >笔记已提交审核,感谢分享笔记!</p>');
  867. alert('笔记已提交审核,感谢分享笔记!');
  868. }else{
  869. statusdiv.html('<p class="ajax-error" >'+data.msg+'</p>');
  870. }
  871. commentform.find('textarea[name=comment]').val('');
  872. }
  873. });
  874. setTimeout(function(){
  875. $("#submit").prop('disabled', false);
  876. }, 10*1000);
  877. }
  878. return false;
  879. });
  880. });
  881. function isBlank(str) {
  882. return (!str || /^\s*$/.test(str));
  883. }
  884. </script>
  885. <link rel="stylesheet" href="/wp-content/themes/runoob/assets/css/qa.css?1.37">
  886. <link rel="stylesheet" type="text/css" href="//cdn.bootcss.com/simditor/2.3.6/styles/simditor.min.css" />
  887. <script type="text/javascript" src="//static.runoob.com/assets/simditor/2.3.6/scripts/module.js"></script>
  888. <script type="text/javascript" src="//static.runoob.com/assets/simditor/2.3.6/scripts/hotkeys.js"></script>
  889. <script type="text/javascript" src="//cdn.bootcss.com/simditor/2.3.6/lib/simditor.min.js"></script> <div class="sidebar-box ad-box ad-box-large">
  890. <div class="ad-336280" style="display: none;">
  891. </div>
  892. </div>
  893. </div>
  894. </div>
  895. <!-- 右边栏 -->
  896. <div class="fivecol last right-column">
  897. <!--
  898. <div class="tab tab-light-blue" style="text-align: center;">关注微信</div>
  899. <div class="sidebar-box">
  900. <a href="http://m.runoob.com/" target="_blank"> <img src="http://www.runoob.com/wp-content/themes/w3cschool.cc/assets/img/qrcode.jpg" alt="移动版"> </a>
  901. <div class="qqinfo">
  902. <a target="_blank" href="http://jq.qq.com/?_wv=1027&k=dOwwKN" id="qqhref">
  903. <img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="菜鸟家族" title="菜鸟家族"></a>
  904. <span>(群号:<span id="qqid">365967760</span>)</span>
  905. </div>
  906. </div>
  907. -->
  908. <style>
  909. .sidebar-tree .double-li {
  910. width:300px;
  911. }
  912. .sidebar-tree .double-li li {
  913. width: 44%;
  914. line-height: 1.5em;
  915. border-bottom: 1px solid #ccc;
  916. float: left;
  917. display: inline;
  918. }
  919. </style>
  920. <div class="sidebar-box ad-box ad-box-large">
  921. <div class="sidebar-box advertise-here" style="margin: 0 auto;">
  922. <a href="javascript:void(0);" style="font-size: 16px; color:#64854c;font-weight:bold;"> <i class="fa fa-list" aria-hidden="true"></i> 分类导航</a>
  923. </div>
  924. <div class="sidebar-box sidebar-cate">
  925. <div class="sidebar-tree" >
  926. <ul><li style="margin: 0;"><a href="javascript:void(0);" class="tit"> HTML / CSS</a><ul class="double-li"><li><a title="HTML 教程" href="//www.runoob.com/html/html-tutorial.html">HTML 教程</a></li><li><a title="HTML5 教程" href="//www.runoob.com/html/html5-intro.html">HTML5 教程</a></li><li><a title="CSS 教程" href="//www.runoob.com/css/css-tutorial.html">CSS 教程</a></li><li><a title="CSS3 教程" href="//www.runoob.com/css3/css3-tutorial.html">CSS3 教程</a></li><li><a title="Bootstrap 教程" href="//www.runoob.com/bootstrap/bootstrap-tutorial.html">Bootstrap 教程</a></li><li><a title="Font Awesome 教程" href="//www.runoob.com/font-awesome/fontawesome-tutorial.html">Font Awesome 教程</a></li><li><a title="Foundation 教程" href="//www.runoob.com/foundation/foundation-tutorial.html">Foundation 教程</a></li></ul></li><li style="margin: 0;"><a href="javascript:void(0);" class="tit"> JavaScript</a><ul class="double-li"><li><a title="JavaScript 教程" href="//www.runoob.com/js/js-tutorial.html">JavaScript 教程</a></li><li><a title="HTML DOM 教程" href="//www.runoob.com/htmldom/htmldom-tutorial.html">HTML DOM 教程</a></li><li><a title="jQuery 教程" href="//www.runoob.com/jquery/jquery-tutorial.html">jQuery 教程</a></li><li><a title="AngularJS 教程" href="//www.runoob.com/angularjs/angularjs-tutorial.html">AngularJS 教程</a></li><li><a title="AngularJS2 教程" href="//www.runoob.com/angularjs2/angularjs2-tutorial.html">AngularJS2 教程</a></li><li><a title="Vue.js 教程" href="//www.runoob.com/vue2/vue-tutorial.html">Vue.js 教程</a></li><li><a title="React 教程" href="//www.runoob.com/react/react-tutorial.html">React 教程</a></li><li><a title="jQuery UI 教程" href="//www.runoob.com/jqueryui/jqueryui-tutorial.html">jQuery UI 教程</a></li><li><a title="jQuery EasyUI 教程" href="//www.runoob.com/jeasyui/jqueryeasyui-tutorial.html">jQuery EasyUI 教程</a></li><li><a title="Node.js 教程" href="//www.runoob.com/nodejs/nodejs-tutorial.html">Node.js 教程</a></li><li><a title="AJAX 教程" href="//www.runoob.com/ajax/ajax-tutorial.html">AJAX 教程</a></li><li><a title="JSON 教程" href="//www.runoob.com/json/json-tutorial.html">JSON 教程</a></li><li><a title="Highcharts 教程" href="//www.runoob.com/highcharts/highcharts-tutorial.html">Highcharts 教程</a></li><li><a title="Google 地图 教程" href="//www.runoob.com/googleapi/google-maps-basic.html">Google 地图 教程</a></li></ul></li><li style="margin: 0;"><a href="javascript:void(0);" class="tit"> 服务端</a><ul class="double-li"><li><a title="PHP 教程" href="//www.runoob.com/php/php-tutorial.html">PHP 教程</a></li><li><a title="Python 教程" href="//www.runoob.com/python/python-tutorial.html">Python 教程</a></li><li><a title="Python3 教程" href="//www.runoob.com/python3/python3-tutorial.html">Python3 教程</a></li><li><a title="Django 教程" href="//www.runoob.com/django/django-tutorial.html">Django 教程</a></li><li><a title="Linux 教程" href="//www.runoob.com/linux/linux-tutorial.html">Linux 教程</a></li><li><a title="Docker 教程" href="//www.runoob.com/docker/docker-tutorial.html">Docker 教程</a></li><li><a title="Ruby 教程" href="//www.runoob.com/ruby/ruby-tutorial.html">Ruby 教程</a></li><li><a title="Java 教程" href="//www.runoob.com/java/java-tutorial.html">Java 教程</a></li><li><a title="C 教程" href="//www.runoob.com/c/c-tutorial.html">C 教程</a></li><li><a title="C++ 教程" href="//www.runoob.com/cplusplus/cpp-tutorial.html">C++ 教程</a></li><li><a title="Perl 教程" href="//www.runoob.com/perl/perl-tutorial.html">Perl 教程</a></li><li><a title="Servlet 教程" href="//www.runoob.com/servlet/servlet-tutorial.html">Servlet 教程</a></li><li><a title="JSP 教程" href="//www.runoob.com/jsp/jsp-tutorial.html">JSP 教程</a></li><li><a title="Lua 教程" href="//www.runoob.com/lua/lua-tutorial.html">Lua 教程</a></li><li><a title="Scala 教程" href="//www.runoob.com/scala/scala-tutorial.html">Scala 教程</a></li><li><a title="Go 教程" href="//www.runoob.com/go/go-tutorial.html">Go 教程</a></li><li><a title="设计模式" href="//www.runoob.com/design-pattern/design-pattern-tutorial.html">设计模式</a></li><li><a title="正则表达式" href="//www.runoob.com/regexp/regexp-tutorial.html">正则表达式</a></li><li><a title="ASP 教程" href="//www.runoob.com/asp/asp-tutorial.html">ASP 教程</a></li><li><a title="AppML 教程" href="//www.runoob.com/appml/appml-tutorial.html">AppML 教程</a></li><li><a title="VBScript 教程" href="//www.runoob.com/vbscript/vbscript-tutorial.html">VBScript 教程</a></li></ul></li><li style="margin: 0;"><a href="javascript:void(0);" class="tit"> 数据库</a><ul class="double-li"><li><a title="SQL 教程" href="//www.runoob.com/sql/sql-tutorial.html">SQL 教程</a></li><li><a title="Mysql 教程" href="//www.runoob.com/mysql/mysql-tutorial.html">Mysql 教程</a></li><li><a title="SQLite 教程" href="//www.runoob.com/sqlite/sqlite-tutorial.html">SQLite 教程</a></li><li><a title="MongoDB 教程" href="//www.runoob.com/mongodb/mongodb-tutorial.html">MongoDB 教程</a></li><li><a title="Redis 教程" href="//www.runoob.com/redis/redis-tutorial.html">Redis 教程</a></li><li><a title="Memcached 教程" href="//www.runoob.com/Memcached/Memcached-tutorial.html">Memcached 教程</a></li></ul></li><li style="margin: 0;"><a href="javascript:void(0);" class="tit"> 移动端</a><ul class="double-li"><li><a title="Android 教程" href="//www.runoob.com/w3cnote/android-tutorial-intro.html">Android 教程</a></li><li><a title="Swift 教程" href="//www.runoob.com/swift/swift-tutorial.html">Swift 教程</a></li><li><a title="jQuery Mobile 教程" href="//www.runoob.com/jquerymobile/jquerymobile-tutorial.html">jQuery Mobile 教程</a></li><li><a title="ionic 教程" href="//www.runoob.com/ionic/ionic-tutorial.html">ionic 教程</a></li><li><a title="Kotlin 教程" href="//www.runoob.com/kotlin/kotlin-tutorial.html">Kotlin 教程</a></li></ul></li><li style="margin: 0;"><a href="javascript:void(0);" class="tit"> XML 教程</a><ul class="double-li"><li><a title="XML 教程" href="//www.runoob.com/xml/xml-tutorial.html">XML 教程</a></li><li><a title="DTD 教程" href="//www.runoob.com/dtd/dtd-tutorial.html">DTD 教程</a></li><li><a title="XML DOM 教程" href="//www.runoob.com/dom/dom-tutorial.html">XML DOM 教程</a></li><li><a title="XSLT 教程" href="//www.runoob.com/xsl/xsl-tutorial.html">XSLT 教程</a></li><li><a title="XPath 教程" href="//www.runoob.com/xpath/xpath-tutorial.html">XPath 教程</a></li><li><a title="XQuery 教程" href="//www.runoob.com/xquery/xquery-tutorial.html">XQuery 教程</a></li><li><a title="XLink 教程" href="//www.runoob.com/xlink/xlink-tutorial.html">XLink 教程</a></li><li><a title="XPointer 教程" href="//www.runoob.com/xlink/xlink-tutorial.html">XPointer 教程</a></li><li><a title="XML Schema 教程" href="//www.runoob.com/schema/schema-tutorial.html">XML Schema 教程</a></li><li><a title="XSL-FO 教程" href="//www.runoob.com/xslfo/xslfo-tutorial.html">XSL-FO 教程</a></li><li><a title="SVG 教程" href="//www.runoob.com/svg/svg-tutorial.html">SVG 教程</a></li></ul></li><li style="margin: 0;"><a href="javascript:void(0);" class="tit"> ASP.NET</a><ul class="double-li"><li><a title="ASP.NET 教程" href="//www.runoob.com/aspnet/aspnet-tutorial.html">ASP.NET 教程</a></li><li><a title="C# 教程" href="//www.runoob.com/csharp/csharp-tutorial.html">C# 教程</a></li><li><a title="Web Pages 教程" href="//www.runoob.com/aspnet/webpages-intro.html">Web Pages 教程</a></li><li><a title="Razor 教程" href="//www.runoob.com/aspnet/razor-intro.html">Razor 教程</a></li><li><a title="MVC 教程" href="//www.runoob.com/aspnet/mvc-intro.html">MVC 教程</a></li><li><a title="Web Forms 教程" href="//www.runoob.com/aspnet/aspnet-intro.html">Web Forms 教程</a></li></ul></li><li style="margin: 0;"><a href="javascript:void(0);" class="tit"> Web Service</a><ul class="double-li"><li><a title="Web Service 教程" href="//www.runoob.com/webservices/webservices-tutorial.html">Web Service 教程</a></li><li><a title="WSDL 教程" href="//www.runoob.com/wsdl/wsdl-tutorial.html">WSDL 教程</a></li><li><a title="SOAP 教程" href="//www.runoob.com/soap/soap-tutorial.html">SOAP 教程</a></li><li><a title="RSS 教程" href="//www.runoob.com/rss/rss-tutorial.html">RSS 教程</a></li><li><a title="RDF 教程" href="//www.runoob.com/rdf/rdf-tutorial.html">RDF 教程</a></li></ul></li><li style="margin: 0;"><a href="javascript:void(0);" class="tit"> 开发工具</a><ul class="double-li"><li><a title="Eclipse 教程" href="//www.runoob.com/eclipse/eclipse-tutorial.html">Eclipse 教程</a></li><li><a title="Git 教程" href="//www.runoob.com/git/git-tutorial.html">Git 教程</a></li><li><a title="Firebug 教程" href="//www.runoob.com/firebug/firebug-tutorial.html">Firebug 教程</a></li></ul></li><li style="margin: 0;"><a href="javascript:void(0);" class="tit"> 网站建设</a><ul class="double-li"><li><a title="HTTP 教程" href="//www.runoob.com/http/http-tutorial.html">HTTP 教程</a></li><li><a title="网站建设指南" href="//www.runoob.com/web/web-buildingprimer.html">网站建设指南</a></li><li><a title="浏览器信息" href="//www.runoob.com/browsers/browser-information.html">浏览器信息</a></li><li><a title="网站主机教程" href="//www.runoob.com/hosting/hosting-tutorial.html">网站主机教程</a></li><li><a title="TCP/IP 教程" href="//www.runoob.com/tcpip/tcpip-tutorial.html">TCP/IP 教程</a></li><li><a title="W3C 教程" href="//www.runoob.com/w3c/w3c-tutorial.html">W3C 教程</a></li><li><a title="网站品质" href="//www.runoob.com/quality/quality-tutorial.html">网站品质</a></li></ul></li></ul> </div>
  927. </div>
  928. </div>
  929. <br>
  930. <div class="sidebar-box ad-box ad-box-large">
  931. <div class="sidebar-box advertise-here">
  932. <a href="javascript:void(0);">Advertisement</a>
  933. </div>
  934. <div class="ad-600160">
  935. <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  936. <!-- 侧栏1 -->
  937. <ins class="adsbygoogle"
  938. style="display:inline-block;width:160px;height:600px"
  939. data-ad-client="ca-pub-5751451760833794"
  940. data-ad-slot="4106274865"></ins>
  941. <script>
  942. (adsbygoogle = window.adsbygoogle || []).push({});
  943. </script>
  944. </div>
  945. </div>
  946. </div></div>
  947. </div>
  948. <script>
  949. var aid = 18450;
  950. var uid = 0;
  951. var url = '/wp-content/themes/runoob/option/user/userinfo.php';
  952. $(function() {
  953. $.post( url, {aid:aid, action:"collarticle", opt:'init'}, function( data ) {
  954. if(data.error==0) {
  955. $("#content").find("h1:first").append(data.msg);
  956. $(".comment-signarea").hide();
  957. $("#commentform").show();
  958. $("#comment-author-info li:lt(2)").hide();
  959. $("#is_user_logged_in").val(1);
  960. $(".comt-title p:first").html(data.username);
  961. } else {
  962. $(".comment-signarea").show();
  963. $("#commentform").hide();
  964. $("#is_user_logged_in").val(0);
  965. }
  966. },'json');
  967. })
  968. function coll() {
  969. $.post( url, {aid:aid, action:"collarticle", opt:'add'},function( data ) {
  970. if(data.error==0) {
  971. $("#content").find("h1:first").find("a").attr("href","javascript:void(0);");
  972. $("#content").find("h1:first").find("img").attr("src","http://www.runoob.com/wp-content/themes/runoob/assets/img/coll2.png").css({width:32+"px",height:32+"px"});
  973. }
  974. alert(data.msg);
  975. },'json');
  976. }
  977. </script>
  978. <!-- 反馈对话框开始 -->
  979. <script src="/wp-content/themes/runoob/assets/feedback/stable/2.0/feedback.js"></script>
  980. <link rel="stylesheet" href="/wp-content/themes/runoob/assets/feedback/stable/2.0/feedback.css" />
  981. <script type="text/javascript">
  982. $.feedback({
  983. ajaxURL: '/feedback/runoob_feedback.php',
  984. html2canvasURL: '/wp-content/themes/runoob/assets/feedback/stable/2.0/html2canvas.js'
  985. });
  986. </script>
  987. <!-- 反馈对话框结束 -->
  988. <button class="feedback-btn feedback-btn-gray">反馈/建议</button>
  989. <!-- 底部 -->
  990. <div id="footer" class="mar-t50">
  991. <div class="runoob-block">
  992. <div class="runoob cf">
  993. <dl>
  994. <dt>
  995. 在线实例
  996. </dt>
  997. <dd>
  998. &middot;<a target="_blank" href="/html/html-examples.html">HTML 实例</a>
  999. </dd>
  1000. <dd>
  1001. &middot;<a target="_blank" href="/css/css-examples.html">CSS 实例</a>
  1002. </dd>
  1003. <dd>
  1004. &middot;<a target="_blank" href="/js/js-examples.html">JavaScript 实例</a>
  1005. </dd>
  1006. <dd>
  1007. &middot;<a target="_blank" href="/ajx/ajax-examples.html">Ajax 实例</a>
  1008. </dd>
  1009. <dd>
  1010. &middot;<a target="_blank" href="/jquery/jquery-examples.html">jQuery 实例</a>
  1011. </dd>
  1012. <dd>
  1013. &middot;<a target="_blank" href="/xml/xml-examples.html">XML 实例</a>
  1014. </dd>
  1015. <dd>
  1016. &middot;<a target="_blank" href="/java/java-examples.html">Java 实例</a>
  1017. </dd>
  1018. </dl>
  1019. <dl>
  1020. <dt>
  1021. 字符集&工具
  1022. </dt>
  1023. <dd>
  1024. &middot; <a target="_blank" href="/charsets/html-charsets.html">HTML 字符集设置</a>
  1025. </dd>
  1026. <dd>
  1027. &middot; <a target="_blank" href="/tags/html-ascii.html">HTML ASCII 字符集</a>
  1028. </dd>
  1029. <dd>
  1030. &middot; <a target="_blank" href="/tags/ref-entities.html">HTML ISO-8859-1</a>
  1031. </dd>
  1032. <dd>
  1033. &middot; <a target="_blank" href="/tags/html-symbols.html">HTML 实体符号</a>
  1034. </dd>
  1035. <dd>
  1036. &middot; <a target="_blank" href="/tags/html-colorpicker.html">HTML 拾色器</a>
  1037. </dd>
  1038. <dd>
  1039. &middot; <a target="_blank" href="//c.runoob.com/front-end/53">JSON 格式化工具</a>
  1040. </dd>
  1041. </dl>
  1042. <dl>
  1043. <dt>
  1044. 最新更新
  1045. </dt>
  1046. <dd>
  1047. &middot;
  1048. <a href="http://www.runoob.com/w3cnote/17-wallpaper-for-programmer.html" title="17 张程序员壁纸推荐">17 张程序员壁纸...</a>
  1049. </dd>
  1050. <dd>
  1051. &middot;
  1052. <a href="http://www.runoob.com/w3cnote/linux-autologin-shell.html" title="Linux 实现自动登陆远程机器">Linux 实现自动...</a>
  1053. </dd>
  1054. <dd>
  1055. &middot;
  1056. <a href="http://www.runoob.com/python3/python3-func-reversed.html" title="Python3 reversed 函数">Python3 reverse...</a>
  1057. </dd>
  1058. <dd>
  1059. &middot;
  1060. <a href="http://www.runoob.com/python3/python3-func-tuple.html" title="Python3 tuple 函数">Python3 tuple 函数</a>
  1061. </dd>
  1062. <dd>
  1063. &middot;
  1064. <a href="http://www.runoob.com/python3/python3-func-bytes.html" title="Python3 bytes 函数">Python3 bytes 函数</a>
  1065. </dd>
  1066. <dd>
  1067. &middot;
  1068. <a href="http://www.runoob.com/python3/python3-func-exec.html" title="Python3 exec 函数">Python3 exec 函数</a>
  1069. </dd>
  1070. <dd>
  1071. &middot;
  1072. <a href="http://www.runoob.com/python3/python3-func-enumerate.html" title="Python3 enumerate() 函数">Python3 enumera...</a>
  1073. </dd>
  1074. </dl>
  1075. <dl>
  1076. <dt>
  1077. 站点信息
  1078. </dt>
  1079. <dd>
  1080. &middot;
  1081. <a target="_blank" href="//mail.qq.com/cgi-bin/qm_share?t=qm_mailme&amp;email=ssbDyoOAgfLU3crf09venNHd3w" rel="external nofollow">意见反馈</a>
  1082. </dd>
  1083. <dd>
  1084. &middot;
  1085. <a target="_blank" href="/disclaimer">免责声明</a>
  1086. </dd>
  1087. <dd>
  1088. &middot;
  1089. <a target="_blank" href="/aboutus">关于我们</a>
  1090. </dd>
  1091. <dd>
  1092. &middot;
  1093. <a target="_blank" href="/archives">文章归档</a>
  1094. </dd>
  1095. </dl>
  1096. <div class="search-share">
  1097. <div class="app-download">
  1098. <div>
  1099. <strong>关注微信</strong>
  1100. </div>
  1101. </div>
  1102. <div class="share">
  1103. <img width="128" height="128" src="/wp-content/themes/runoob/assets/images/qrcode.png" />
  1104. </div>
  1105. </div>
  1106. </div>
  1107. </div>
  1108. <div class="w-1000 copyright">
  1109. Copyright &copy; 2013-2017 <strong><a href="//www.runoob.com/" target="_blank">菜鸟教程</a></strong>&nbsp;
  1110. <strong><a href="//www.runoob.com/" target="_blank">runoob.com</a></strong> All Rights Reserved. 备案号:闽ICP备15012807号-1
  1111. </div>
  1112. </div>
  1113. <div class="fixed-btn">
  1114. <a class="go-top" href="javascript:void(0)" title="返回顶部"> <i class="fa fa-angle-up"></i></a>
  1115. <a class="qrcode" href="javascript:void(0)" title="关注我们"><i class="fa fa-qrcode"></i></a>
  1116. <a class="writer" target="_blank" href="//mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=ssbDyoOAgfLU3crf09venNHd3w" style="font-size: 12px;" title="Bug 反馈"><i class="fa fa-envelope-o" style="font-size: 20px;"></i></a>
  1117. <!-- qrcode modal -->
  1118. <div id="bottom-qrcode" class="modal panel-modal hide fade in">
  1119. <h4>微信关注</h4>
  1120. <div class="panel-body"><img alt="微信关注" width="128" height="128" src="/wp-content/themes/runoob/assets/images/qrcode.png"></div>
  1121. </div>
  1122. </div>
  1123. <div style="display:none;">
  1124. <script>
  1125. var _hmt = _hmt || [];
  1126. (function() {
  1127. var hm = document.createElement("script");
  1128. hm.src = "//hm.baidu.com/hm.js?8e2a116daf0104a78d601f40a45c75b4";
  1129. var s = document.getElementsByTagName("script")[0];
  1130. s.parentNode.insertBefore(hm, s);
  1131. })();
  1132. </script>
  1133. </div>
  1134. <script>
  1135. window.jsui={
  1136. www: '//wwww.runoob.com',
  1137. uri: '//www.runoob.com/wp-content/themes/runoob'
  1138. };
  1139. </script>
  1140. <style>
  1141. ol,ul{list-style:none}.cd-switcher a{text-decoration:none;outline:0}.cd-switcher a:hover{text-decoration:underline}a:focus{outline:0;-moz-outline:0}.main_nav{width:300px;height:60px;margin:60px auto 10px auto}.main_nav li{float:left;width:60px;margin-right:10px;font-size:16px;padding:.6em 1em;border-radius:3em;background:#2f889a;text-align:center}.main_nav li a{color:#fff}.errtip{background-color:#fceaea;color:#db5353;padding:8px 15px;font-size:14px;border:1px solid #fc9797;border-radius:5px}.cd-user-modal{position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(52,54,66,0.9);z-index:3;overflow-y:auto;cursor:pointer;visibility:hidden;opacity:0;-webkit-transition:opacity .3s 0,visibility 0 .3s;-moz-transition:opacity .3s 0,visibility 0 .3s;transition:opacity .3s 0,visibility 0 .3s}.cd-user-modal.is-visible{visibility:visible;opacity:1;-webkit-transition:opacity .3s 0,visibility 0 0;-moz-transition:opacity .3s 0,visibility 0 0;transition:opacity .3s 0,visibility 0 0}.cd-user-modal.is-visible .cd-user-modal-container{-webkit-transform:translateY(0);-moz-transform:translateY(0);-ms-transform:translateY(0);-o-transform:translateY(0);transform:translateY(0)}.cd-user-modal-container{position:relative;width:90%;max-width:500px;background:#FFF;margin:3em auto 4em;cursor:auto;border-radius:.25em;-webkit-transform:translateY(-30px);-moz-transform:translateY(-30px);-ms-transform:translateY(-30px);-o-transform:translateY(-30px);transform:translateY(-30px);-webkit-transition-property:-webkit-transform;-moz-transition-property:-moz-transform;transition-property:transform;-webkit-transition-duration:.3s;-moz-transition-duration:.3s;transition-duration:.3s}.cd-user-modal-container .cd-switcher:after{content:"";display:table;clear:both}.cd-user-modal-container .cd-switcher li{width:50%;float:left;text-align:center}.cd-user-modal-container .cd-switcher li:first-child a{border-radius:.25em 0 0 0}.cd-user-modal-container .cd-switcher li:last-child a{border-radius:0 .25em 0 0}.cd-user-modal-container .cd-switcher a{font-size:1.2em;font-weight:bold;display:block;width:100%;height:50px;line-height:50px;background:#e8f1e2;color:#96b880}.cd-user-modal-container .cd-switcher a.selected{background:#FFF;color:#505260}@media only screen and (min-width:600px){.cd-user-modal-container{margin:4em auto}.cd-user-modal-container .cd-switcher a{height:70px;line-height:70px}}.cd-form{padding:1.4em}.cd-form .fieldset{position:relative;margin:1.4em 0}.cd-form .fieldset:first-child{margin-top:0}.cd-form .fieldset:last-child{margin-bottom:0}.cd-form label{font-size:16px;font-size:.875rem}.cd-form label.image-replace{display:inline-block;position:absolute;left:15px;top:50%;bottom:auto;-webkit-transform:translateY(-50%);-moz-transform:translateY(-50%);-ms-transform:translateY(-50%);-o-transform:translateY(-50%);transform:translateY(-50%);height:20px;width:20px;overflow:hidden;text-indent:100%;white-space:nowrap;color:transparent;text-shadow:none;background-repeat:no-repeat;background-position:50% 0}.cd-form label.cd-username{background-image:url("/wp-content/themes/runoob/assets/img/cd-icon-username.svg")}.cd-form label.cd-email{background-image:url("/wp-content/themes/runoob/assets/img/cd-icon-email.svg")}.cd-form label.cd-password{background-image:url("/wp-content/themes/runoob/assets/img/cd-icon-password.svg")}.cd-form input{margin:0;padding:0;border-radius:.25em}.cd-form input.full-width{width:80%}.cd-form input.full-width2{width:94%}.cd-form input.has-padding{padding:12px 20px 12px 50px}.cd-form input.has-border{border:1px solid #d2d8d8;-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;-o-appearance:none;appearance:none}.cd-form input.has-border:focus{border-color:#98b880;box-shadow:0 0 5px rgba(52,54,66,0.1);outline:0}.cd-form input.has-error{border:1px solid #d76666}.cd-form input[type=password]{padding-right:65px}.cd-form input[type=submit]{padding:16px 0;cursor:pointer;background:#96b97d;color:#FFF;font-weight:bold;border:0;-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;-o-appearance:none;appearance:none;font-size:1.2em;font-weight:bold}.no-touch .cd-form input[type=submit]:hover,.no-touch .cd-form input[type=submit]:focus{background:#3599ae;outline:0}@media only screen and (min-width:600px){.cd-form{padding:2em}.cd-form .fieldset{margin:2em 0}.cd-form .fieldset:first-child{margin-top:0}.cd-form .fieldset:last-child{margin-bottom:0}.cd-form input.has-padding{padding:16px 20px 16px 50px}.cd-form input[type=submit]{padding:16px 0}}.cd-close-form{display:block;position:absolute;width:40px;height:40px;right:0;top:-40px;background:url("/wp-content/themes/runoob/assets/img/cd-icon-close.svg") no-repeat center center;text-indent:100%;white-space:nowrap;overflow:hidden}@media only screen and (min-width:1170px){}#cd-login,#cd-signup,#cd-reset-password{display:none}#cd-login.is-selected,#cd-signup.is-selected,#cd-reset-password.is-selected{display:block}
  1142. </style>
  1143. <div class="cd-user-modal">
  1144. <div class="cd-user-modal-container">
  1145. <ul class="cd-switcher">
  1146. <li><a href="javascript:;">用户登录</a></li>
  1147. <li><a href="javascript:;">注册新用户</a></li>
  1148. </ul>
  1149. <div id="cd-login"> <!-- 登录表单 -->
  1150. <div class="cd-form">
  1151. <p class="fieldset">
  1152. <label class="image-replace cd-username" for="signin-username">用户名</label>
  1153. <input class="full-width has-padding has-border" id="signin-username" name=username type="text" placeholder="输入用户名">
  1154. </p>
  1155. <p class="fieldset">
  1156. <label class="image-replace cd-password" for="signin-password">密码</label>
  1157. <input class="full-width has-padding has-border" id="signin-password" name="password" type="password" placeholder="输入密码">
  1158. </p>
  1159. <p class="fieldset">
  1160. <input type="checkbox" id="remember-me" checked>
  1161. <label for="remember-me">记住登录状态</label>
  1162. <a href="//www.runoob.com/reset-password" style="float: right;padding-right: 20px;" target="_blank">忘记密码?</a>
  1163. </p>
  1164. <input type="hidden" name="action" value="signin">
  1165. <p class="fieldset">
  1166. <input class="full-width2" type="submit" value="登 录">
  1167. </p>
  1168. <div class="err-msg"></div>
  1169. </div>
  1170. </div>
  1171. <div id="cd-signup"> <!-- 注册表单 -->
  1172. <div class="cd-form">
  1173. <p class="fieldset">
  1174. <label class="image-replace cd-password" for="verifycode">邀请码</label>
  1175. <input class="full-width has-padding has-border" id="signup-verifycode" name="verifycode" type="text" placeholder="输入邀请码">
  1176. </p>
  1177. <p class="fieldset">
  1178. <label class="image-replace cd-username" for="signup-username">用户名</label>
  1179. <input class="full-width has-padding has-border" id="signup-username" name="name" type="text" placeholder="输入用户名">
  1180. </p>
  1181. <p class="fieldset">
  1182. <label class="image-replace cd-email" for="signup-email">邮箱</label>
  1183. <input class="full-width has-padding has-border" name="email" id="signup-email" type="email" placeholder="输入mail">
  1184. </p>
  1185. <p class="fieldset">
  1186. <label class="image-replace cd-password" for="signup-password">密码</label>
  1187. <input class="full-width has-padding has-border" id="signup-password" name="password" type="password" placeholder="输入密码">
  1188. </p>
  1189. <p class="fieldset">
  1190. <label class="image-replace cd-password" for="signup-password">重复输入密码</label>
  1191. <input class="full-width has-padding has-border" id="signup-password" name="password2" type="password" placeholder="重复输入密码">
  1192. </p>
  1193. <!--
  1194. <p class="fieldset">
  1195. <input type="checkbox" id="accept-terms">
  1196. <label for="accept-terms">我已阅读并同意 <a href="javascript:;">用户协议</a></label>
  1197. </p>
  1198. -->
  1199. <input type="hidden" name="action" value="signup">
  1200. <p class="fieldset">
  1201. <input class="full-width2" type="submit" value="注册新用户">
  1202. </p>
  1203. <p class="fieldset">
  1204. <a href="//www.runoob.com/w3cnote/runoob-user-test-intro.html#invite" target="_blank">如何获取邀请码?</a>
  1205. </p>
  1206. <div class="err-msg"></div>
  1207. </div>
  1208. </div>
  1209. <a href="javascript:;" class="cd-close-form">关闭</a>
  1210. </div>
  1211. </div>
  1212. <script src="/wp-content/themes/runoob/assets/js/main.js?v=1.147"></script>
  1213. <script src="//static.runoob.com/assets/libs/hl/run_prettify.js"></script>
  1214. </body>
  1215. </html>