2013-01-06 46 views
0

我有以下問題:CSS:3x3 repeat-y背景頂部和底部限制?

我需要應用一個背景,其上有一個repeat-y來填充我的垂直div。現在我有這個問題,它不應該從上填寫:0,但是從85px遠離頂部,所以我需要像

position:absolute; 
top:85px; 
bottom:85px; 

在CSS應用背景。

我的問題的一些附加信息可以在這裏找到:How to place a responsive background according to content height with HTML/CSS?

我怎樣才能做到這一點?

我的結構如下:

<content><innercontent></innercontent></content> 

內容具有瀏覽器的整個寬度,並innercontent具有固定的寬度。

#content { 
    background: 
    url("images/bg-top.png") no-repeat scroll center top, 
    url("images/bg-bottom.png") no-repeat scroll center bottom, 
    url("/images/bg-middle.png") repeat-y scroll center center transparent; 
    position:relative; 
} 

有人能幫助我嗎?代替center的背景位置y

#content { 
    background: 
    url("images/bg-top.png") no-repeat scroll center top, 
    url("images/bg-bottom.png") no-repeat scroll center bottom, 
    url("/images/bg-middle.png") repeat-y scroll center 85px transparent; 
    position:relative; 
} 

注意85px

回答

0

終於讓我找到它:

只是創建與此一個div:

#middle-stripe { 
    background: url("/wp-content/themes/vitaphone/library/images/bg-middle.png") repeat-y scroll center center transparent; 
    position: absolute; 
    top:85px; 
    bottom:85px; 
    width:100%; 
} 
相關問題