標籤:des style blog http io color ar os 使用
來源:http://www.ido321.com/1214.html
前兩天翻譯了一篇文章,關於利用css的border屬性製作基本圖形:http://www.ido321.com/1200.html
在此基礎上,今天分享一篇文章給大家,如果利用CSS製作冒泡提示框。
先看2張:
CSS:
/* 對話氣泡 用法:使用.speech-bubble和.speech-bubble-DIRECTION類 <div class="speech-bubble speech-bubble-top">Hi there</div>*/ .speech-bubble { position: relative; background-color: #292929; width: 200px; height: 150px; line-height: 150px; /* 垂直置中 */ color: white; text-align: center; border-radius: 10px; font-family: sans-serif;} .speech-bubble:after { content: ‘‘; position: absolute; width: 0; height: 0; border: 15px solid;} /* 箭頭的位置 */.speech-bubble-top:after { border-bottom-color: #292929; left: 50%; bottom: 100%; margin-left: -15px; }.speech-bubble-right:after { border-left-color: #292929; left: 100%; top: 50%; margin-top: -15px; } .speech-bubble-bottom:after { border-top-color: #292929; top: 100%; left: 50%; margin-left: -15px; } .speech-bubble-left:after { border-right-color: #292929; top: 50%; right: 100%; margin-top: -15px; }
HTML:
<!DOCTYPE html><html> <head> <link rel="stylesheet" type="text/css" href="maopao.css"> <title>Test</title> </head> <body> <div class="speech-bubble speech-bubble-top"> 箭頭在頂部 </div> <br/> <div class="speech-bubble speech-bubble-bottom"> 箭頭在底部 </div> <br/> <div class="speech-bubble speech-bubble-left"> 箭頭在左側 </div> <br/> <div class="speech-bubble speech-bubble-right"> 箭頭在右側 </div> </body></html>
示範地址:http://jsfiddle.net/80r9kjs2/embedded/result/
下一篇:PHP:產生不重複隨機數的方法
純CSS製作冒泡提示框