简体   繁体   中英

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 . 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

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.

How can I make Safari not cut off the dots?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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