2012-05-21 33 views

回答

7

是的,你可以只用CSS來做,但這並不容易,結果是......好吧,醜陋。 你可能要檢查這個問題,以及:CSS for inverted curved tabs

編輯:我今天有更好的主意,檢查此http://dabblet.com/gist/2762234

的CSS如下:

h1 { 
    min-width: 150px; 
    height: 30px; 
    margin: 0; 
    /**border: solid 2px #979797;/**/ 
    border-bottom: none; 
    border-radius: 8px 0 0 0; 
    box-shadow: -2px -2px 2px #a5a5b1; 
    display: inline-block; 
    position: relative; 
    background: linear-gradient(#e8e8ea, #f8f8fa); 
} 
h1:before { 
    /**top: -2px;/**/ 
    /**/top: 0;/**/ 
    right: -23px; 
    width: 30px; 
    height: 30px; 
    border-radius: 0 8px 0 0; 
    /**border: solid 2px #979797;/**/ 
    border-left: none; 
    border-bottom: none; 
    box-shadow: 2px -2px 2px #a5a5b1; 
    /** outline: solid 1px red; /* uncomment this to check position */ 
    transform: skewX(30deg); 
    position: absolute; 
    background: linear-gradient(#e8e8ea, #f8f8fa); 
    content: ''; 
} 
h1:after { 
    right: -44px; 
    /**bottom: 0;/**/ 
    /**/bottom: 2px;/**/ 
    width: 16px; 
    height: 8px; 
    /**border: solid 2px #979797;/**/ 
    border-top: none; 
    border-right: none; 
    border-radius: 0 0 0 8px; 
    box-shadow: inset 2px -2px 2px #a5a5b1, -4px 4px 2px #f8f8fa; 
    /** outline: solid 1px red; /* uncomment this to check position */ 
    transform: skewX(30deg); 
    position: absolute; 
    content: ''; 
} 
div { 
    min-height: 130px; 
    margin-top: -7px; 
    /**border: solid 2px #979797;/**/ 
    border-radius: 0 8px 0 0; 
    box-shadow: -2px -2px 2px #a5a5b1, 2px -2px 2px #a5a5b1; 
    background: linear-gradient(#f8f8fa, #f6f6f8); 
} 

它可以製成看起來更漂亮,但這將需要固定寬度的標題和div上的僞元素。

+0

真棒:)謝謝! – F0RR

0

您可以通過使用堆疊在彼此上的幾個元素來實現這一點。
我不認爲這是你想要製作的東西,所以我的建議是去背景圖片。

相關問題