純CSS製作冒泡提示框

來源:互聯網
上載者:User

標籤: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製作冒泡提示框

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.