简体   繁体   English

CSS repeat-x仅适用于最右边的像素行

[英]CSS repeat-x for only the right most line of pixels

We currently have our 145x45 header logo set as the background of our mobile header, and have the rest of the header's 'background-color' matching the background of the logo. 当前,我们将145x45标头徽标设置为移动标头的背景,标头的其余“背景颜色”与徽标的背景相匹配。

The logo has a line a few pixels high across the top of the image, which under the current configuration doesn't extend beyond the image. 徽标在图像顶部有一条高几个像素的线,在当前配置下,该线不会延伸到图像之外。

How can I make the rightmost 1px(w) x 45px(h) of the logo to fill (repeat-x?) the remainder of the header, so that the line at the top of the image extends across the entire header? 如何使徽标的最右边的1px(w)x 45px(h)填充(重复-x?)标题的其余部分,以使图像顶部的行延伸到整个标题?

Create a 1x45 image with the line, use with repeat-x in a div, place a div inside that div with the logo image like this: 用该行创建一个1x45图像,与div中的repeat-x一起使用,在div内放置一个带有徽标图像的div,如下所示:

<div style="background-image: url('line_image.png'); background-repeat: repeat-x: height: 45px;">
    <div style="background-image: url('logo.png'); background-repeat: no-repeat; height: 45px;"></div>
</div>

Sorry for inline CSS, should be in a .css-file. 抱歉,内联CSS应该位于.css文件中。

PS: Code not testet, let me know if it doesn't work. PS:代码不是testet,请告诉我它是否无效。

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

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