單純使用CSS實現動態提示資訊

來源:互聯網
上載者:User

也許已經有人發現可以這樣寫...

CSS代碼部分
a.info {
position:relative; z-index:0; background-color:#ccc; color:#000; text-decoration:none }

a.info:hover {
z-index:1; background-color:#ff0 }

a.info span {
display: none }

a.info:hover span {
display:block; position:absolute; top:12px; left:2px; width:160px; border:1px solid #0cf; background-color:#cff; color:#000; text-align: center }

body區調用方法
1.<a class="info" href="javascript:;"><b>需要添加註釋的文本</b><span>提示資訊</span></a>

2.<a class="info" href="javascript:;"><img src="需要添加註釋的圖片"><span>提示資訊</span></a><br /><style> body { font:verdena; font-size:14px; color:#000 } h1{ font:verdena; font-size:22px; color:#000 } h2{ font:verdena; font-size:15px; color:#000; text-align:left } div#main { margin:30 } /*關鍵代碼開始*/ a.info { position:relative; z-index:0; background-color:#ccc; color:#000; text-decoration:none } a.info:hover { z-index:1; background-color:#ff0 } a.info span { display: none } a.info:hover span { display:block; position:absolute; top:25px; left:60px; width:130px; border:1px solid #0cf; background-color:#cff; color:#000; text-align: center } /*關鍵代碼結束*/ </style>單純使用CSS實現動態提示資訊不用js可以實現資訊提示效果?!(title和alt除外)By [51js.com]zdzhuoIe5.5+, Opera7.0, Netscap7.0, Mozilla1.4 都能正常使用<p><b>這是提示資訊</b>www.51js.com不需要js就能實現的提示資訊<b>單純使用CSS實現提示資訊</b>一個非常簡便的方法<br />原理也淺顯易懂</p><p>這是我在51js.com的專用頭像</p><p>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.