网格线 - 使用线性渐变时的背景大小限制?

时间:2015-03-17 10:51:29

标签: css css3 google-chrome webkit chromium

Chromium / Google Chrome中的background-size是否存在某种限制?

请参阅此处的小提琴:https://jsfiddle.net/kc9d6k54/3/

enter image description here

我正在尝试实现不同间隔的网格线,这在某种程度上有效,但在本例中,当我经过256px时,线性渐变的第二部分消失了。

示例代码:

.grid-lines div {
    background: 
        linear-gradient(0deg, #900 0, rgba(0,0,0,0) 1px, rgba(0,0,0,0) 1px, rgba(0,0,0,0) 100%), 
        linear-gradient(0deg, #bbf 0, rgba(0,0,0,0) 1px, rgba(0,0,0,0) 1px, rgba(0,0,0,0) 100%);
    background-origin: padding-box;
    background-clip: border-box;                    
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
}

...

.grid-lines .fifth {
    background-size: 1px 320px, 1px 40px;
    left: 600px;
}

Q1:为什么会这样?

Q2:我可以使用哪些变通方法/替代方法来获得我想要的效果(基本上是320px480px的间隔)

BONUS Q:为什么160px色谱柱的暗红色线显得更暗?

1 个答案:

答案 0 :(得分:1)

Came across this when doing a grid for a midi editor. I needed vertical lines for Bar, Quarter note and subdivisions that could be changed depending on time signature.

Thanks to your observation, I tried a 2px setting for the bar marker. Seems that Chrome tries to scale proportionally (slightly).

SELECT distinct client_ip, member_id
FROM ads.fbs_page_view_staging Staging
INNER JOIN (SELECT EXTRACT(year from created_at) AS CustomYear,
         client_ip,
         member_id,
         COUNT(*) AS Views
  FROM ads.fbs_page_view_staging
  WHERE member_id = 2
  GROUP BY CustomYear,
           client_ip,
           member_id
  HAVING COUNT(*) = 1) SingularViews
ON SingularViews.client_ip=Staging.client_ip 
AND SingularViews.member_id=Staging.member_id
ORDER BY Staging.client_ip, Staging.member_id

https://jsfiddle.net/b239Ldrv/