【发布时间】:2020-07-25 10:31:20
【问题描述】:
我有一个这样的字符串
.header{
font-family:;
background-color:red;
color:blue;
line-height:;
}
.footer{
background-color:green;
color:;
}
我想像这样转换这个字符串
.header{
background-color:red;
color:blue;
}
.footer{
background-color:green;
}
我怎样才能做到这一点?
【问题讨论】:
-
1.你从哪里收到这样的输入? 2. CSS中忽略了空属性,那么这个练习的目的是什么?
-
感谢您的快速回复。我正在动态生成内部 CSS。像这样显示到浏览器中。 prnt.sc/ry0lw2 所以我想摆脱没有任何价值的财产。每次显示动态 CSS 值(prnt.sc/ry0off)时,我都可以实现此添加条件。但我想知道是否还有其他方便的方法。
标签: php string replace str-replace