简体   繁体   English

背景图像部分有repeat-x

[英]Background Image portion with repeat-x

I have an image which is 99pixels wide and 100pixels height. 我有一个99像素宽和100像素高的图像。

The image contains 3 vertical lines of colours Red, Orange, Green each being 33px by 100px in that image. 该图像包含3条垂直线条颜色红色,橙色,绿色,每条图像在该图像中为33px×100px。

What I want to work out though is how to set the div background image to select lets say just orange and then repeat the image as the background. 我想要解决的是如何设置div背景图像选择让我们说只是橙色,然后重复图像作为背景。

So i did: 所以我做了:

background-position: 66px 0px

The problem is the Green colour is still showing i only want it to show orange and repeat just that portion. 问题是绿色仍然显示我只希望它显示橙色并重复该部分。 Is that possible in CSS? 这有可能在CSS?

The answer is no, not x-browser, unless you're attempting to repeat the background vertically for a div/box that is just 33px wide. 答案是否定的,不是x浏览器,除非你试图垂直重复背景为一个只有33像素宽的div / box。 If you really just want a colored background, just do eg {background-color:orange;} . 如果你真的只想要一个彩色背景,那就去做{background-color:orange;}

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

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