Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Bilingual Text Toggle Demo</title>
- <style type="text/css">
- /* general page styling */
- :root {
- --page-bg: #CCB;
- --content-bg: #EED;
- --text-color: #222;
- --accent-color: #722;
- }
- main {
- background-color: var(--page-bg);
- color: var(--text-color);
- padding: 1em 2em;
- }
- article {
- margin-top: 1em;
- background-color: var(--content-bg);
- }
- h1, h2, a {
- color: var(--accent-color);
- }
- /* original & translated version contents: side-by-side or toggleable display */
- article.translated {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- }
- article.translated > section {
- padding: 1em;
- width: 45%;
- /* to ditch flexbox, comment out the article.translated block and uncomment this */
- /* display: inline-block;
- vertical-align: top; */
- }
- input#show-original:checked ~ article.translated > section.translation {
- display: none;
- }
- input#show-original:checked ~ article.translated > section.original {
- width: 100%;
- }
- input#show-translation:checked ~ article.translated > section.original {
- display: none;
- }
- input#show-translation:checked ~ article.translated > section.translation {
- width: 100%;
- }
- /* version-toggle controls */
- input[name="versions"] {
- display: none;
- }
- label {
- background-color: var(--content-bg);
- color: var(--accent-color);
- padding: 0.5em;
- border: 1px solid var(--accent-color);
- border-radius: 5px
- }
- input[name="versions"]:checked + label {
- background-color: var(--accent-color);
- color: var(--content-bg);
- }
- </style>
- </head>
- <body>
- <main>
- <input type="radio" name="versions" id="show-original">
- <label for="show-original">Original</label>
- <input type="radio" name="versions" id="show-translation">
- <label for="show-translation">Translation</label>
- <input type="radio" name="versions" id="show-both" checked>
- <label for="show-both">Side-by-side</label>
- <article class="translated">
- <section class="original">
- <h2>Section 1.10.32 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC</h2>
- <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui do<a href="https://lipsum.com/">lorem ipsum quia dolor sit amet</a>, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p>
- </section>
- <section class="translation">
- <h2>1914 translation by H. Rackham</h2>
- <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?</p>
- </section>
- </article>
- </main>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement