Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling"select" font size, or height

Status
Not open for further replies.

avivit

Technical User
Jul 5, 2000
456
IL
How can I control the height of a list box (select)
in NETSCAPE (former verions than NS6)?
I tried style, but it does not effect netscape.
I also tried to smaller the font size in it, but it
wouldn't work in netscape. I tried all of the following:

<font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-5&quot;>
<select....>
</select>
</font>

OR
<select....>
<font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-5&quot;>
<option...>
</font>
</select>

Or even:

<select....>
<option><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-3&quot;>my option</font>
</select>

Or:

<select....>
<option><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;-3&quot;>my option</font></option>
</select>

None is working for me.

Any idea?
Thanks

 
You can change the font in Netscape 4 using styles...

select {
font-family: Verdana;
font-size: 10px;
width: 191px;
}

For some reason, though, I can only get this to work if I put it in an external .css file... it won't do anything in style tags in the heading.
 
Try:

<SELECT NAME=&quot;mySelect&quot; STYLE=&quot;font-size: 8pt;&quot;>
<OPTION....>....</OPTION>
.
.
.
</SELECT> Mise Le Meas,

Mighty :)
 
Mighty-
Did you test that in Netscape 4.7x? I'm just curious because I can only get external files to affect a <select> and I'm wondering if its a bug or something I'm doing...
 
I have only tested it in IE and Netscape 6. Unfortunately, I haven't tested it on N4.7 Mise Le Meas,

Mighty :)
 
Wel...I did, long time ago. It does not work in netscape 4.xx.
aperfectcircle, that's an interesting thing u r saying.
I'll check it out too.thanks.
Thanks mighty too.
 
aperfectcircle, I tried an external css file, and it's not working.
Can you put a link to a page of yours that does that job?
 
I think I just figured it out... Try this:
Code:
<html>
<head>
<title>Form</title>
<style type=&quot;text/css&quot;>
body {
font-family: Verdana;
font-size: 10px;
}

select {
font-family: Verdana;
font-size: 10px;
}
</style>
</head>
<body>
<form>
<select name=&quot;Type&quot;>
	<option></option>
	<option>Option 1</option>
	<option>Option 2</option>
	<option>Option 3</option>
	<option>Option 4</option>
	<option>Option 5</option>
</select>
</form>
</body>
</html>

The style of the select doesn't seem to want to change unless the body is changed.
 
Actually, from what I can tell, defining the select does nothing in Netscape 4; the style of the select is determined by the body style.
Of course, you'll want to leave the select styles in there to make it work cross-browser...

 
Would it work if you put the select within a layer and set the style for that layer. It kind of retricts you if you have to set the body style to the one you want in the select. Mise Le Meas,

Mighty :)
 
It does kind of restrict you, but you can always define different classes...

I guess you could do this if you really wanted:
Code:
<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;defaultns.css&quot; />
<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;default.css&quot; media=&quot;all&quot; />

Netscape 4 will use the first stylesheet and skip the second one because it doesn't understand the media=&quot;all&quot;. IE and Netscape 6 will use the second one.
 
Nice.
But why will IE and ns6 use the second css? The first is familiar as well.
right?
 
That's right, but it will read the first one and then the second one. So if you define something in the first one that you want different in IE and NS6 you'll have to redefine it in the second one with the new properties.
 
After trying your solutions I am still having problems in defining the font size in the select box. I am using IE5+ and Netscape 4.7. The code below is working in IE but not in Netscape. Please help.

The Style sheet file is ns1.css
-------------------------------
select {
font-family: Verdana;
font-size: 5px;
width: 400px;
}
------------------------------

The HTML code is
--------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<style type=&quot;text/css&quot;>
body {
font-family: Verdana;
font-size: 5px;
}

select {
font-family: Verdana;
font-size: 5px;
}
</style>

<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;ns1.css&quot; />
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;&quot;>
<select name=&quot;select&quot; width=400 style=&quot;font-size: 10; font-color: red; width=400&quot;>
<option value=&quot;1&quot;>first</option>
<option value=&quot;2&quot;>second</option>
<option value=&quot;3&quot;>third</option>
</select>
</form>
</body>
</html>
--------------
 
ketankshah.
I don't even remember what I tried then. Probably everything.
However, eventually nothing worked for me in NS4.xx, so I moved on, leaving it as is.
Sorry...
 
I also just saw the following suggestion, and it does change the font inside the select box in NS4.xx, but not the select height, though it should, as written there.
It turns out that the text size is bigger than the select box, and it looks cut.

If u wanna take a look anyway, here it is:
 
We had the same problem with wanting to limit the size of a drop-down menu in Netscape 4.xx.

Our solution was rather simple and seems to work well. For IE, we defined the style local to the select form. Then, to size for Netscape, we simply placed <font size=&quot;-1&quot;></font> around the select form:

<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;&quot;>
<font size=-1><select name=&quot;select&quot; width=400 style=&quot;font-size: 8;&quot;>
<option value=&quot;1&quot;>first</option>
<option value=&quot;2&quot;>second</option>
<option value=&quot;3&quot;>third</option>
</select></font>
</form>

Hope this helps anyone still stumped.
 
Very nice to know.
Thanks very much for sharing this information.
I will sure use it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top