View Full Version : Two CSS questions

12-22-2006, 12:30 PM

I am using the following function to build a DIV automatically:

function Style(zxcele,zxcstyle,zxctxt){
if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
return zxcele;

I am trying to build a layer with rotated text using the style element writing-code:

var y_axis_text =Style('DIV',{position:'absolute',left:(-fs*6)+'px',top:(ch/3)+'px',width:'10px',height:'1px',color:'black',fontSize:(fs + 2)+'px',writing-mode: 'tb-rl'}, "No. of Reps");

FrontPage gives me an error regarding missing ":".
If i change the syntax to:

var y_axis_text =Style('DIV',{position:'absolute',left:(-fs*6)+'px',top:(ch/3)+'px',width:'10px',height:'1px',color:'black',fontSize:(fs + 2)+'px',"writing-mode": 'tb-rl'}, "No. of Reps");

Then the text is not rotated.
Any hints why??

Second question is regarding text alignment to the left. Can you provide me to the right Style syntax to align text to the left in a DIV?

Million Thanks!

12-22-2006, 12:36 PM
For the second one, text-align: left; (which is the default) sets text to align to the left within a div.

For the first, ain't got a clue :)

12-22-2006, 07:15 PM
That first question really doesn't have anything to do with CSS. Come up with a better title (http://codingforums.com/postguide.htm) and I'll move this to the Javascript forum for you.