2
A
回答
1
OK,你可以試試這個(在Firefox 11只測試)...
HTML
<div class="bubble">
<div class="content">
Some content can go inside this bubble...
</div>
<div class="arrow"><div class="arrow-shadow"></div></div>
</div>
CSS
.bubble
{
background:#D0D0D0;
background-image: -ms-linear-gradient(top, #BBB 0%, #EEE 100%);
background-image: -moz-linear-gradient(top, #BBB 0%, #EEE 100%);
background-image: -o-linear-gradient(top, #BBB 0%, #EEE 100%);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #BBB), color-stop(1, #EEE));
background-image: -webkit-linear-gradient(top, #BBB 0%, #EEE 100%);
background-image: linear-gradient(top, #BBB 0%, #EEE 100%);
border-radius:10px;
border-top:2px solid #EEE;
border-bottom:2px solid #AAA;
position:relative;
width:380px;
height:100px;
}
.bubble .content
{
padding:10px;
}
/* Arrow */
.bubble .arrow {
position:absolute;
top:50%;
left:100%;
margin-top:-12px;
}
.bubble .arrow:after,
.arrow .arrow-shadow
{
border:10px solid Transparent;
border-color:rgba(255,255,255,0) rgba(255,255,255,0) rgba(255,255,255,0) rgba(255,255,255,0);
content:' ';
height:0;
position:absolute;
width:0;
}
.bubble .arrow:after
{
border-left-color:#D3D3D3;
}
.arrow .arrow-shadow
{
height:3px;
border-left-color:#AAA;
}
這是在我看來,一個黑客位的,但它似乎與你想要的相當接近。唯一可能出現的問題是:
- 向後兼容性。老版本的IE可能會窒息,因此值得測試它並根據需要篡改IE兼容性。
- 如果箱子變得太大,箭頭可能與箱子看起來顏色不同。我找不到解決這個問題的方法,所以你可能會有更好的結果把箭頭放在一個靜態位置。
你可以在這裏找到的jsfiddle:http://jsfiddle.net/eWj6q/13/
1
我可能不會推薦它的最好的技術,但不知何故,將更好地工作:
使用線性漸變:線性漸變是一個比在一條直線上兩點之間的距離之間的色彩逐漸過渡。最簡單的方法是,線條漸變將沿着整條線條的兩種顏色成比例變化。
div {
background: -moz-linear-gradient(#FFF, #000);
background: -ms-linear-gradient(#FFF, #000);
background: -o-linear-gradient(#FFF, #000);
background: -webkit-linear-gradient(#FFF, #000);
}
0
這是最接近我可以使用div的。
大概可以通過使用畫布獲得更好的箭頭,但它會需要JavaScript。 Javascript也可以解決箭頭狀框的背景顏色問題。 :)
截圖:http://i.stack.imgur.com/iwlMj.png
HTML部分:
<div class="nice">
<div class="arrow-container">
</div>
Hello world!
</div>
CSS部分:
body {padding:50px; background-color: #ccc;}
.nice {
background-color: white;
position: relative;
min-height:65px;
padding:10px 10px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background: -moz-linear-gradient(top, #cccccc 0%, #ffffff 100%); /* firefox */
box-shadow: 0 0px 0px #fff, 0 0px 1px #666, inset -1px -1px 0px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8);
-moz-box-shadow: 0 0 0 #FFFFFF, 0 0 1px #666666, -1px -1px 0 rgba(0, 0, 0, 0.5) inset, 0 1px 1px rgba(255, 255, 255, 0.8) inset;
-webkit-box-shadow: 0 0px 0px #fff, 0 0px 1px #666, inset -1px -1px 0px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.8);
text-shadow: 0 1px 2px #fff;
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#cccccc), color-stop(100%,#ffffff));
font-size:20px
}
.arrow-container {
background-color: white;
height: 26px;
position: absolute;
right: 0;
top: 50%;
margin-top:-13px;
margin-right:-19px;
width: 20px;
background: -moz-linear-gradient(top, #dcdcdc 0%, #ededed 100%); /* firefox */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#dcdcdc), color-stop(100%,#ededed));
box-shadow: 0 0px 0px #fff, 1px 0px 1px #666, inset 0px -1px 0px rgba(0,0,0,0.5), inset -1px 1px 1px rgba(255,255,255,0.8);
-moz-box-shadow: 0 0 0 #FFFFFF, 1px 0 1px #666666, 0px -1px 0 rgba(0, 0, 0, 0.5) inset, -1px 1px 1px rgba(255, 255, 255, 0.8) inset;
-webkit-box-shadow: 0 0px 0px #fff, 1px 0px 1px #666, inset 0px -1px 0px rgba(0,0,0,0.5), inset -1px 1px 1px rgba(255,255,255,0.8);
-webkit-border-top-right-radius: 7px;
-moz-border-top-right-radius: 7px;
border-top-right-radius: 7px;
-webkit-border-bottom-right-radius: 25px;
-moz-border-bottom-right-radius: 25px;
border-bottom-right-radius: 25px;
}
相關問題
- 1. 什麼是最好的技術材料的演示工具?
- 2. 這個技術叫什麼?
- 3. 使用界面最好的技術情況是什麼?
- 4. 什麼是最好的Django syncdb死機調試技術?
- 5. 這是什麼java視圖技術?
- 6. 這種情況下最適合的認證技術是什麼?
- 7. 這種情況下最適合的語言/技術是什麼?
- 8. 什麼是從對象記錄數據的最佳技術?
- 9. 什麼是最好的和最活躍的開源.Net搜索技術?
- 10. 什麼是最好的,最有效的客戶端池技術與Erlang
- 11. 這種技術叫做什麼?
- 12. 好的技術產品路線圖應該是什麼樣的?
- 13. JavaScript面向對象的編程技術,這叫做什麼?
- 14. 什麼是輪詢結果欄的好技術?
- 15. 如何在sql中創建循環,這是這裏最好的技術嗎?
- 16. 使用Drupal創建在線目錄,什麼是最好的模塊/技術?
- 17. 可變高度與自定義背景圖像 - 什麼是最好的技術?
- 18. 最好的數據庫/分類技術
- 19. 最好的pdf壓縮技術?
- 20. PHP:最好的重定向技術
- 21. 最好的驗證庫技術
- 22. 什麼是繪製3D孔的圖形技術?
- 23. .NET中MSMQ的新技術是什麼
- 24. 什麼是無線技術的配置
- 25. Dailymile.com背後的技術是什麼
- 26. Google Buzz背後的技術是什麼?
- 27. 先切技術的含義是什麼?
- 28. ejb的核心技術是什麼?
- 29. 什麼是CSS中的精靈技術
- 30. 這些與技術相關的術語有什麼區別?
這只是解決了梯度,我在合併右箭頭到整個事情更有趣。因爲箭頭也具有漸變效果,應該對應於整個酒吧中的漸變。這是艱難的事情。 – 2012-03-31 12:02:29
@jesteuvidim adobe photoshop怎麼樣?只需[點擊此處](http://www.adobe.com/cfusion/exchange/index.cfm?l=-1&s=5&o=desc&exc=16&cat=202&event=producthome) – harry 2012-03-31 12:20:19