2013-04-29 30 views
2

今天我再次與空中飛人(耶)奮鬥!background-image:空中飛人CSS3

這是怎麼一回事呢:

我有一個模板,它是這樣的:

render

(這是一個煙盒模板)

我想在CSS中,以重新創建包的右側:

HTML

<div class="cote-droit"> 
    <div class="inner"> 
     <div class="cote-droit-top"></div> 
     <div class="cote-droit-bot"></div> 
    </div> 
</div> 

CSS

.cote-droit .inner 
    { 
     position: relative; 
     height: 293.04px; 
     width: 64.076px; 
    } 
.cote-droit-top 
    { 
     width: 64.076px; 
     height: 72.49px; 
     background: url(pack.png) -227.567px -604.822px no-repeat; 
    } 

.cote-droit-bot 
    { 
     width: 64.076px; 
     height: 220.55px; 
     background: url(pack.png) -227.567px 0 no-repeat; 
    } 

有了這個代碼,我有:

top

bottom

哪些是右側的兩個部分,空白部分在r的底部飛行側和右側的頂部的空白部分

所以我的問題是:我如何得到這樣的:

render

使用絕對位置不會使白色部分消失,我有點卡住了!

感謝您的時間,我等着你的答案在這裏,並在必要時

+0

你必須使用上述相同的圖像?怎麼樣一個[精靈圖像](http://css-tricks.com/css-sprites/)? 您能詳細說明應該在cote-ditit-top和cote-droit-bot中放置什麼文本嗎?應該如何將背景定位於其他文本或其他div節點? – surfmuggle 2013-04-29 19:09:25

+0

不幸的是,我必須 – 2013-04-29 19:11:18

+1

OT:混合français和英文'.cote-droit-top + .bot(tom)'?1 JCVD點爲你^^ – FelipeAls 2013-04-29 19:13:50

回答

1

的問題是對角線很樂意給你更多的信息。因此,爲了避免它,你可以做到以下幾點:

  • .cote-所有權,機器人會停止在對角部分的開始
  • .cote-所有權頂部可能從黃色背景過濾器上面取並在紅線下方以獲得正確的高度。

這是您的代碼,具有背景和高度的輕微運動。這個not yet what you are looking但它可能足夠接近給出一些想法。

更新:我刪除了cote-droit-top的背景圖像,並使用背景顏色代替。 This solution should come pretty close(至少它是直到我讀你最近的評論)

.cote-droit .inner 
{ 
    position: relative; 
    height: 293.04px; 
    width: 64.076px; 
} 

.cote-droit-top 
{ 
    width: 64.076px; 
    height: 34px; 
    background: url(http://i.stack.imgur.com/uiluV.jpg) -227.567px -604px no-repeat;   
} 

.cote-droit-bot 
{ 
    width: 64.076px; 
    height: 180px; 
    background: url(http://i.stack.imgur.com/uiluV.jpg) -227.567px -40px no-repeat;   
} 
+0

嗯,這是一個很好的解決方案,但恐怕不行,因爲大多數包都有側面設計...... 有什麼我可以在JS中做的事情,以使其正確嗎? – 2013-04-29 19:58:15

+0

您可以在香菸包裝模板圖像中放置一個標記(紅色邊框),您想將這些部件放在哪個區域? – surfmuggle 2013-04-29 20:08:35

+0

完成我的好先生! – 2013-04-29 20:11:42