Click to See Complete Forum and Search --> : Variable question
Heppers
01-23-2003, 03:40 PM
I am using a script to generate a menu but the output is unpredictable.
The size of the menu boxes is in pixels but the font size seems to be in points i.e.
var FontSize=10;
How would I express the fontsize in terms of pixels?
Thanks,
Ian
var FontSize = "<STYLE>tagName {10px}</STYLE>"
Where "tagName" is equal to the name of the tag you'd like to increase the size of. You may also use a class:
var FontSize = "<STYLE>.className {10px}</STYLE>"
Where, ".className" is the name of your class.
LAwebTek
01-23-2003, 04:14 PM
The only way I know to do this is to use CSS. For example:
<style type="text/css">
.tekst {
font-size: 10px;
}
</style>
Then, in your script you can simply apply the class to the text rather than assigning a font size. i.e..
<script>
document.write("<span class=tekst>Hello World</span>");
</script>
I have also tried to define pixels rather than points in HTML and outside of using CSS I have not found another solution. I'll keep watching this thread though in case someone else does know. :)
Heppers
01-23-2003, 04:22 PM
I had a play with that but it seems to have made the problem worse.
When using points to describe the font size sometimes the text would be too big for the box depending on browser but when using the pixel size method it makes it worse - the font size changes when you change the text size on the browser.
I notice there are the variables
var LeftPaddng=3; // Left padding
var TopPaddng=2; // Top padding
is there a right and bottom padding variable?
Ian