mP.
mP.

Reputation: 18266

good algo to flip css properties from left <-> right

Is it safe to assume that all properties that end with "left" have a corresponding "right" and vice versa and flipping them the other way is sufficient ? Naturally one would also need to flip values with left and right. Have i missed anything ?

EDIT Yes i would like to be create an horizontal flipped stylesheet for RTL and LTR etc.

imagine a simple contrived stylesheet

#something {
   border-left: 2px;
   border-right: 5px;
   border-top: 12px;
}

h flipped becomes

#something {
   border-right: 2px;
   border-left: 5px;
   border-top: 12px;
}

Upvotes: 0

Views: 105

Answers (1)

Mr Lister
Mr Lister

Reputation: 46599

Not all left and right properties end in -left or -right.

For instance, you have border-left-color and border-right-color, so you'll need to do more than just check for "ending in -left or ending in -right".

You might also want to take a look Mozilla's RTL Locales pages. Interesting read.

Upvotes: 1

Related Questions