dynamic CSS styles with PHP to print coloumn captions on run time

dynamic CSS styles with PHP to print coloumn captions on run time

how can i convert the followings if's in such a way that it generate a
dynamic css styles .. in CSS, there are only margins are different. it is
actully a detection of coloumn caption printed on run time. Any better
implemantation or idea will b thankful. eg. dynamic calculation : $string
= 12 and $string1 = 23 then the caption should on second coloumn header
folowing loop takes style id, can it is posible to run also dynamic CSS ..
for ($x=0,$y=1; $x<20,$y<20; $x++, $y++)
if ($string == $x && $string1==$y) $style="s".($x-3).$y;
Foloowings are the if's:
if ($string == 1 && $string1==2) $style="s12";
if ($string == 2 && $string1==3) $style="s13";
if ($string == 3 && $string1==4) $style="s14";
if ($string == 4 && $string1==5) $style="s15";
if ($string == 5 && $string1==6) $style="s16";
if ($string == 6 && $string1==7) $style="s17";
if ($string == 7 && $string1==8) $style="s18";
if ($string == 8 && $string1==9) $style="s19";
if ($string == 9 && $string1==10) $style="s20";
if ($string == 10 && $string1==11) $style="s21";
if ($string == 11 && $string1==12) $style="s22";
if ($string == 12 && $string1==13) $style="s23";
if ($string == 13 && $string1==14) $style="s24";
if ($string == 14 && $string1==15) $style="s25";
if ($string == 15 && $string1==16) $style="s26";
if ($string == 16 && $string1==17) $style="s27";
.s12{ text-align: left;padding-left: 60px; border: solid 1px #CCCCCC;
margin: 10px 780px 0px 90px; }
.s13{ text-align: left;padding-left: 60px; border: solid 1px #CCCCCC;
margin: 10px 680px 0px 190px; }
.s14{ text-align: left;padding-left: 60px; border: solid 1px #CCCCCC;
margin: 10px 580px 0px 285px; }
.s15{ text-align: left;padding-left: 60px; border: solid 1px #CCCCCC;
margin: 10px 480px 0px 380px; }
.s16{ text-align: left;padding-left: 60px; border: solid 1px #CCCCCC;
margin: 10px 380px 0px 95px; }
.s17{ text-align: left;padding-left: 60px; border: solid 1px #CCCCCC;
margin: 10px 280px 0px 95px; }
.s18{ text-align: left;padding-left: 60px; border: solid 1px #CCCCCC;
margin: 10px 180px 0px 95px; }
.s19{ text-align: left;padding-left: 60px; border: solid 1px #CCCCCC;
margin: 10px 80px 0px 95px; }