Forum How do I...?

Applying different styles to left-columns and right-columns?

yet
See screenshot.

There is a DIV for each section of the TOC.

The TOC is rendered using a two-column layout.

The DIVs in the left column should have a colored border inside the left column and a right border inside the right column.

Right now I am using

background: url('green.png') repeat-y

for generating the border with a small colored PNG file.

Is there some way for putting conditionally on the left or right side?
  1. Bildschirmfoto 2011-06-23 um 17.49.04.png184.9 kB
jim_albright
Try putting a div around each section that you want a different background color for. Give each div a different class then use

.toc1 { background-color: lime }
.toc2 { background-color: pink }

Jim Albright
Wycliffe Bible Translators

mikeday
Unfortunately there is no way to change the style depending on whether it is in a left or right column, although there are ways to change the style if it is on a left or right facing page.
yet
jim_albright wrote:
Try putting a div around each section that you want a different background color for. Give each div a different class then use

.toc1 { background-color: lime }
.toc2 { background-color: pink }



This is unrelated to the question.
yet
mikeday wrote:
Unfortunately there is no way to change the style depending on whether it is in a left or right column, although there are ways to change the style if it is on a left or right facing page.


This is what I though :->
StoneCypher
Old fat man say: when you ask how to make your solution work, instead of how to satisfy your problem, available approach get lost in lurch. There are more ways to differentiate a background than to know what column you're in. Look back, young grasshopper, into the shameful DNA of the new HTML4 css1 era, when everyone was finding useless things to do with their properties.

Remember how people faked semi-transparency and semi-anti-transparency before the advent of PNG: shared use of fixed-position equivalent bloatoshopped backgrounds.

And thus, we discover one ugly, hackish, 100% servicable method: fixed position backgrounds, yo.

<html>
  <head>
    <style type="text/css">

      ul   { margin: 0; padding: 0; column-count: 2; column-gap: 3em; }
      li   { background-attachment: fixed; margin: 0; padding: 0.1em 1em; list-style-type: none; }
      li.r { background-image: url("RedBack.png"); }
      li.b { background-image: url("BlueBack.png"); }
      li.o { background-image: url("OrangeBack.png"); }
      li.p { background-image: url("MagentaBack.png"); }

    </style>
  </head>
  <body>

    <ul>
      <li class="r">Lorem ipsum</li>
      <li class="r">Lorem ipsum</li>
      <li class="r">Lorem ipsum</li>
      <li class="b">Lorem ipsum</li>
      <li class="b">Lorem ipsum</li>
      <li class="b">Lorem ipsum</li>
      <li class="o">Lorem ipsum</li>
      <li class="o">Lorem ipsum</li>
      <li class="p">Lorem ipsum</li>
      <li class="p">Lorem ipsum</li>
    </ul>

    <p>dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

  </body>
</html>


Just remember: when someone says you can't, neither you nor they are cheating sufficiently hard.

John Haugeland is http://fullof.bs/

  1. BlueBack.png2.8 kB
  2. OrangeBack.png2.8 kB
  3. RedBack.png2.8 kB
StoneCypher
Needed another post for the fourth color.

John Haugeland is http://fullof.bs/

  1. MagentaBack.png2.8 kB
StoneCypher
Lol. I tried to add the result, and "the extension PDF is not allowed."

Bloatoshop screenshot jutsu to the rescue.

John Haugeland is http://fullof.bs/

  1. RESULTSISAID.png143.6 kB
StoneCypher
Also, I really like this visual style, and I would like your permission to steal it. I'll use a fundamentally different padding scheme, color scheme and structure, but the outlying saturation bars are gorgeous, and I want them, but only with permission. (It'd be sick if people just bit off of requests for help without permission, because that'd make requests for help dangerous.)

John Haugeland is http://fullof.bs/