拆分CSS中给出的background-image属性字符串

时间:2019-02-17 08:49:03

标签: javascript css arrays

我有一个background-image的CSS属性,具有此值。

background-image: url("https://someURLgoeshere/someImageName.jpg\"),linear-gradient(to bottom, hsla(110, 100.00%, 50.00%, 1.00),hsla(110, 100.00%, 50.00%, 1.00)), radial-gradient(to bottom, hsla(251, 100.00%, 50.00%, 0.86),hsla(251, 100.00%, 50.00%, 0.86));

从上面给定的值字符串中,我想以不同的方式分割每个背景图像。 我想要类似下面的输出。

const someArray = [url("https://someURLgoeshere/someImageName.jpg\"), linear-gradient(to bottom, hsla(110, 100.00%, 50.00%, 1.00),hsla(110, 100.00%, 50.00%, 1.00)), radial-gradient(to bottom, hsla(251, 100.00%, 50.00%, 0.86),hsla(251, 100.00%, 50.00%, 0.86)) ]

简而言之,我想拆分值并将其存储在明智的字符串Index中。

有人可以帮忙吗?

0 个答案:

没有答案