0
Having a CSS file would like, using PHP, to change a line by joining the rules that can be abbreviated.
For example in this code:
margin-top: -2px; -> abreviável para MARGIN
padding-right: 40px; -> juntável para PADDING
the rules margin-X, padding-X are traceable to the following notation:
parameter: (TOP, RIGHT, BOTTOM, LEFT);
in case it would look like this:
margin: -2px, 0, 0, 0;
padding: 0, 40px, 0, 0;
For other spaces (top, right, bottom, left) not specified the value must be set to 0.
How to do it in PHP?
There’s no css tag on that question?
– Wallace Maxters
I couldn’t understand it.
– rray
@rray I arranged the question
– Elaine
@Wallacemaxters not necessarily
– Elaine
The
margin-top:
would be generated by you or read from a file? this did not give to understand, what is the origin?– rray
first you’d have to learn to pick up the parameters, then put them together.
– Bacco
@rray ah, the source would be a normal css file.. take each parameter inside the {}
– Elaine
The problem here is that for CSS, the order is important, and you cannot skip the parameter in the middle. The most you can do, is to test if all are filled and are equal and use only one, or if you omit some would have to take the default, or Parent, depending on the attribute. Actually the problem of the question is a bit complex, and it would need to be better defined.
– Bacco