简体   繁体   English

CSS:3x3 repeat-y背景的顶部和底部限制?

[英]CSS: 3x3 repeat-y Background top and bottom restrictions?

I have the following problem: 我有以下问题:

I need to apply a background, which have a repeat-y on it, to fill my div vertical. 我需要应用背景,上面有重复的y,以填充div垂直。 Now I have the problem, that it should not fill from top:0 and but from 85px away from top, so I need something like 现在我有一个问题,它不应该从top:0填充,而应该从top离开85px,所以我需要

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

for a background applied in css. 用于CSS中的背景。

Some additional information of my problem is can found here: How to place a responsive background according to content height with HTML / CSS? 我的问题的一些其他信息可以在这里找到: 如何使用HTML / CSS根据内容的高度放置响应背景?

how can i achieve that ? 我该如何实现?

my structure is the following: 我的结构如下:

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

content has the whole width of the browser, and innercontent has a fixed width. 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;
}

Can someone help me ? 有人能帮我吗 ?

If I'm understanding you correctly, simply change it to this: 如果我对您的理解正确,只需将其更改为:

#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;
}

Note the 85px in place of center for the background position y. 注意背景位置y的center位置为85px

http://jsfiddle.net/ghKb2/1/ http://jsfiddle.net/ghKb2/1/

finally i found it: 终于我找到了:

just create a div with this: 只需使用以下命令创建一个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%;
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM