Author Topic: New classes for alignment shortcuts  (Read 3593 times)

Sekoia

  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 1,848
New classes for alignment shortcuts
« on: July 04, 2009, 07:20:06 AM »
Partially in response to Lin Chiao Feng's post, I just added some class stylings to the global Commons.css.

Following can be used on things like table cells and divs:

class="left"  (equivalent to style="text-align: left;")
class="center"  (equivalent to style="text-align: center;")
class="right"  (equivalent to style="text-align: right;")
class="top"  (equivalent to style="vertical-align: top;")
class="middle"  (equivalent to style="vertical-align: middle;")
class="bottom"  (equivalent to style="vertical-align: bottom;")

Following can be used on a table or a table row and will apply the indicated formatting on all of the cells (td and th) in the table:

class="cells-left"
class="cells-center"
class="cells-right"
class="cells-top"
class="cells-middle"
class="cells-bottom"

You can combine horizontal and vertical alignments, as in class="top right" or class="cells-center cells-bottom". You can even toss in other classes, such as class="wikitable cells-top".

Sekoia

  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 1,848
Re: New classes for alignment shortcuts
« Reply #1 on: July 04, 2009, 11:58:35 AM »
I added two more sets of class stylings. Instead of cells-left, you can now use either td-left or th-left to only apply left to the heading or non-heading cells. Similar for the other five alignments.

I also realized that it wasn't working with wikitable... so I fixed it. However, CSS stylings sometimes don't prioritize as expected so let me know if you try something and it doesn't work as expected. :)

Lin Chiao Feng

  • Underling
  • *
  • Posts: 9
Re: New classes for alignment shortcuts
« Reply #2 on: July 04, 2009, 12:30:05 PM »
Nice stuff.  And you knocked another 3 kB off the cheatsheet page!
A Mad Scientist discovers That Which Man Was Not Meant To Know.
A Mad Engineer creates That Which Man Was Not Meant To Have.
It's a subtle, but important, distinction: pure vs. applied insanity.