内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

使用CSS制作對話框氣泡的方法-創(chuàng)新互聯(lián)

這篇文章主要介紹使用CSS制作對話框氣泡的方法,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),湛河企業(yè)網(wǎng)站建設(shè),湛河品牌網(wǎng)站建設(shè),網(wǎng)站定制,湛河網(wǎng)站建設(shè)報價,網(wǎng)絡(luò)營銷,網(wǎng)絡(luò)優(yōu)化,湛河網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強企業(yè)競爭力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時我們時刻保持專業(yè)、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學習、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實用型網(wǎng)站。

我們在和別人通過微信或者qq聊天的時候都會有對話框氣泡,那么這個對話框氣泡是怎么實現(xiàn)的呢?

首先我們來看一下我們需要制作的對話框的效果

使用CSS制作對話框氣泡的方法

接下來我們就來看看這幾種對話氣泡的實現(xiàn)方法

我們來看一下如何實現(xiàn)箭頭向左的對話氣泡

我們需要先來制作一個框架

使用CSS制作對話框氣泡的方法

代碼如下

HTML代碼

<div class="balloon-left">
左邊
</div>

CSS代碼

.balloon-left {
  position: relative;
  display: inline-block;
  padding: 0 15px;
  width: auto;
  min-width: 150px;
  height: 40px;
  line-height: 34px;
  text-align: center;
  background: #44FF44;
  border: 3px solid #000000;
  z-index: 0;
}

接著,我們使用:before來制作箭頭部分,用:after來制作箭頭的邊

CSS代碼

.balloon-left:before {
  border-style: solid;
  border-width: 10px 10px 10px 0;
  border-color: transparent #44FF44 transparent transparent;
  content: "";
  position: absolute;
  top: 50%; left: -8px;
  margin-top: -9px;
  display: block;
  width: 0px;
  height: 0px;
  z-index: 0;
}
.balloon-left:after {
  border-style: solid;
  border-width: 11px 11px 11px 0;
  border-color: transparent #000000 transparent transparent;
  content: "";
  position: absolute;
  top: 50%; left: -12px;
  margin-top: -10px;
  display: block;
  width: 0px;
  height: 0px;
  z-index: -1;
}

運行效果入下所示

使用CSS制作對話框氣泡的方法

這樣就完成了第一個對話氣泡

下面我們就來根據(jù)上述方法來制作箭頭向右的對話氣泡

代碼如下

HTML代碼

<div class="balloon-right">
  右邊
</div>

CSS代碼

.balloon-right {
  position: relative;
  display: inline-block;
  padding: 0 15px;
  width: auto;
  min-width: 150px;
  height: 40px;
  line-height: 34px;
  text-align: center;
  background: #44FF44;
  border: 3px solid #000000;
  z-index: 0;
}
.balloon-right:before {
  border-style: solid;
  border-width: 10px 0 10px 10px;
  border-color: transparent transparent transparent #44FF44;
  content: "";
  position: absolute;
  top: 50%; right: -8px;
  margin-top: -9px;
  display: block;
  width: 0px;
  height: 0px;
  z-index: 0;
}
.balloon-right:after {
  border-style: solid;
  border-width: 11px 0 11px 11px;
  border-color: transparent transparent transparent #000000;
  content: "";
  position: absolute;
  top: 50%; right: -12px;
  margin-top: -10px;
  display: block;
  width: 0px;
  height: 0px;
  z-index: -1;
}

運行上述代碼的效果如下所示:是一個向右的氣泡

使用CSS制作對話框氣泡的方法

最后我們來說箭頭向左和向右的對話氣泡

我們需要用到border-radius屬性讓氣泡變得圓滑

代碼如下

HTML代碼

<div class="balloon-top">向上</div>
  <div class="balloon-bottom">向下</div>

CSS代碼

.balloon-top {
  position: relative;
  display: inline-block;
  padding: 0 15px;
  width: auto;
  min-width: 150px;
  height: 40px;
  line-height: 32px;
  text-align: center;
  background: #44FF44;
  border: 3px solid #000000;
  z-index: 0;
  border-radius: 60%;
}
.balloon-top:before {
  border-style: solid;
  border-width: 0 10px 10px 10px;
  border-color: transparent transparent #44FF44 transparent;
  content: "";
  position: absolute;
  top: -8px; left: 50%;
  margin-left: -9px;
  display: block;
  width: 0px;
  height: 0px;
  z-index: 0;
}
.balloon-top:after {
  border-style: solid;
  border-width: 0 11px 11px 11px;
  border-color: transparent transparent #000000 transparent;
  content: "";
  position: absolute;
  top: -12px; left: 50%;
  margin-left: -10px;
  display: block;
  width: 0px;
  height: 0px;
  z-index: -1;
}
.balloon-bottom {
  position: relative;
  display: inline-block;
  padding: 0 15px;
  width: auto;
  min-width: 150px;
  height: 40px;
  line-height: 34px;
  text-align: center;
  background-color: #44FF44;
  border: 3px solid #000000;
  z-index: 0;
  border-radius: 60%;
}
.balloon-bottom:before {
  content: "";
  position: absolute;
  bottom: -8px; left: 50%;
  margin-left: -9px;
  width: 0px;
  height: 0px;
  border-style: solid;
  border-width: 10px 10px 0 10px;
  border-color: #44FF44 transparent transparent transparent;
  z-index: 0;
}
.balloon-bottom:after {
  border-style: solid;
  border-width: 11px 11px 0 11px;
  border-color: #000000 transparent transparent transparent;
  content: "";
  position: absolute;
  bottom: -12px; left: 50%;
  margin-left: -10px;
  width: 0px;
  height: 0px;
  z-index: -1;
}

效果如下所示

使用CSS制作對話框氣泡的方法

CSS部分有點復(fù)雜,但你可以根據(jù)以上示例通過自定義顏色和形狀來制作各種類型的對話框氣泡。

以上是使用CSS制作對話框氣泡的方法的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)網(wǎng)站制作公司行業(yè)資訊頻道!

本文標題:使用CSS制作對話框氣泡的方法-創(chuàng)新互聯(lián)
文章起源:http://www.rwnh.cn/article44/cejehe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站標簽優(yōu)化、搜索引擎優(yōu)化、云服務(wù)器、網(wǎng)站營銷、外貿(mào)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化
黎川县| 岐山县| 衡南县| 胶州市| 体育| 香格里拉县| 公安县| 石台县| 灯塔市| 邵武市| 棋牌| 肇庆市| 汾阳市| 武功县| 万载县| 平凉市| 汉沽区| 曲松县| 潍坊市| 盐源县| 新平| 丰顺县| 林周县| 茂名市| 广南县| 甘德县| 淳安县| 临澧县| 铅山县| 罗甸县| 大英县| 洛浦县| 定边县| 闽清县| 石河子市| 隆林| 棋牌| 太仓市| 三都| 溆浦县| 灵璧县|