简体   繁体   English

背景重复:当父母变得太宽时,空间似乎停止工作

[英]Background-repeat: space seems to stop working when parent gets too wide

I've been playing around with space and round values for background-repeat .我一直在研究background-repeatspace值和round值。 In theory this should mean I can use a radial gradient to create a nice dotted border on an element without the dots being cut off.从理论上讲,这应该意味着我可以使用径向渐变在元素上创建漂亮的虚线边框,而不会切断圆点。

.test {
  background-repeat: space no-repeat;
  background-size: 20px 10px;
  background-image: radial-gradient(circle closest-side, red calc(100% - 1px), transparent 100%);
  transition: background-image 0.5s linear;
  padding-bottom: 10px !important;
  background-position: left top;
  resize: both;
  overflow: auto;
  border: 2px solid;
  padding: 20px; 
  width: 310px;
}

https://jsbin.com/momiwokena/1/edit?css,output https://jsbin.com/momiwokena/1/edit?css,output

It works nicely in Chrome, but in Safari once the element gets too wide it stops working resulting in cut off dots on the right hand side.它在 Chrome 中运行良好,但在 Safari 中,一旦元素变得太宽,它就会停止工作,导致右侧出现截断点。

How can I make Safari not cut off the dots?我怎样才能让 Safari 不切断点?

EDIT: This has been raised with Apple.编辑:这已被苹果公司提出。

It looks as if you need to include compatible transitions in the code.看起来您需要在代码中包含兼容的转换。

.test {
  background-repeat: space no-repeat;
  background-size: 20px 10px;
  background-image: radial-gradient(circle closest-side, red calc(100% - 1px), transparent 100%);
  -webkit-transition: background-image 0.5s linear; /* Safari */
  transition: background-image 0.5s linear;
  padding-bottom: 10px !important;
  background-position: left top;
  resize: both;
  overflow: auto;
  border: 2px solid;
  padding: 20px; 
  width: 310px;
}

I've heard of other problems too where you need to change the transition code a little but this is what I've gotten.我也听说过其他问题,您需要稍微更改转换代码,但这就是我所得到的。

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

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