2011-08-05 76 views

回答

1

這是最接近我可以用純CSS和HTML得到......唯一的問題是,不能使用漸變的箭頭提示。

<div class="arrow"></div><div class="content">Add new authorization</div> 


.arrow 
{ 
    width:2px; 
    height:2px; 
    border: 12px inset black; 
    border-right-width: 8px; 
    border-color: transparent #5a0 transparent transparent; 
} 
.content 
{ 
    background-color: green; 
    padding:2px 8px 2px 4px; 
    border: 1px solid #490; 
    border-left-width: 0px; 
    background-image: -webkit-linear-gradient(top, #8c0, #070); 
    text-shadow: 1px 1px #8c0, -1px -1px #070 
} 
div {float:left; color:white; 
} 

http://jsfiddle.net/JZaAa/

7

這是接近:http://jsfiddle.net/8RuB6/1/

在IE9和火狐,Chrome,Safari瀏覽器,歌劇的最新版本進行測試。

HTML:

<span class="tooltip">Hover me</span> 

CSS:

.tooltip { 
    position: relative; 
    display: inline-block; 
    font: 13px sans-serif; 
    height: 60px; 
    line-height: 60px; 
    border: 1px solid #444 
} 
.tooltip:hover:before { 
    content: 'Add new authorisation'; 
    position: absolute; 
    z-index: 1; 
    top: 50%; 
    margin-top: -15px; 
    left: 100%; 
    margin-left: 20px; 
    height: 30px; 
    line-height: 30px; 
    padding: 0 9px 0 3px; 
    white-space: nowrap; 
    color: #fff; 
    font-weight: bold; 

    -webkit-border-top-right-radius: 5px; 
    -webkit-border-bottom-right-radius: 5px; 
    -moz-border-radius-topright: 5px; 
    -moz-border-radius-bottomright: 5px; 
    border-top-right-radius: 5px; 
    border-bottom-right-radius: 5px; 

    background: #3b679e; /* Old browsers */ 
    background: -moz-linear-gradient(top, #3b679e 0%, #2b88d9 50%, #207cca 51%, #7db9e8 100%); /* FF3.6+ */ 
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3b679e), color-stop(50%,#2b88d9), color-stop(51%,#207cca), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */ 
    background: -webkit-linear-gradient(top, #3b679e 0%,#2b88d9 50%,#207cca 51%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */ 
    background: -o-linear-gradient(top, #3b679e 0%,#2b88d9 50%,#207cca 51%,#7db9e8 100%); /* Opera11.10+ */ 
    background: -ms-linear-gradient(top, #3b679e 0%,#2b88d9 50%,#207cca 51%,#7db9e8 100%); /* IE10+ */ 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3b679e', endColorstr='#7db9e8',GradientType=0); /* IE6-9 */ 
    background: linear-gradient(top, #3b679e 0%,#2b88d9 50%,#207cca 51%,#7db9e8 100%); /* W3C */ 
} 
.tooltip:hover:after { 
    content: ' '; 
    position: absolute; 
    top: 50%; 
    margin-top: -15px; 
    left: 100%; 
    margin-left: 20px; 
    width: 21px; 
    height: 21px; 
    background: #ccc; 
    -webkit-transform: rotate(45deg); 
    -webkit-transform-origin: 0 0; 
    -moz-transform: rotate(45deg); 
    -moz-transform-origin: 0 0; 
    -o-transform: rotate(45deg); 
    -o-transform-origin: 0 0; 
    -ms-transform: rotate(45deg); 
    -ms-transform-origin: 0 0; 
    transform: rotate(45deg); 
    transform-origin: 0 0; 

    background: #3b679e; /* Old browsers */ 
    background: -moz-linear-gradient(left top, #3b679e 0%, #2b88d9 50%, #207cca 51%, #7db9e8 100%); /* FF3.6+ */ 
    background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#3b679e), color-stop(50%,#2b88d9), color-stop(51%,#207cca), color-stop(100%,#7db9e8)); /* Chrome,Safari4+ */ 
    background: -webkit-linear-gradient(left top, #3b679e 0%,#2b88d9 50%,#207cca 51%,#7db9e8 100%); /* Chrome10+,Safari5.1+ */ 
    background: -o-linear-gradient(left top, #3b679e 0%,#2b88d9 50%,#207cca 51%,#7db9e8 100%); /* Opera11.10+ */ 
    background: -ms-linear-gradient(left top, #3b679e 0%,#2b88d9 50%,#207cca 51%,#7db9e8 100%); /* IE10+ */ 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#3b679e', endColorstr='#7db9e8',GradientType=0); /* IE6-9 */ 
    background: linear-gradient(left top, #3b679e 0%,#2b88d9 50%,#207cca 51%,#7db9e8 100%); /* W3C */ 
} 
相關問題