0

Say I have an unknown number of lines with text. For example:

<p>Line 1</p>
<p>Line 2</p>
<p>Line 3</p>

I want to show them in reverse, so:

Line 3
Line 2
Line 1

I can not use javascript, only CSS. Is this possible?

Note: I have potentially an unlimited number of lines (this is an internal feed and new lines are added on the fly), and am looking for a simple solution that does not involve creating unique CSS for each of the lines (so the solution suggested here does not work: Switching the order of block elements with CSS).

This is an internal system and does not require a lot of compatibility. Recent Chrome/Firefox browsers will do.

1 Answers1

1

This comes to my mind:

<div class="upside-down">
    <p class="upside-down">Line 1</p>
    <p class="upside-down">Line 2</p>
    <p class="upside-down">Line 3</p>
    ...
    <p class="upside-down">Line N</p>
</div>

CSS:

.upside-down {
    -ms-transform: rotate(180deg);
    -webkit-transform: rotate(180deg);
    transform: rotate(180deg);
}
Taras
  • 105
  • 1
  • 7