ot - CSS Table Widths

H

Harag

Hi all

First let me apologize for writing in this news group as its the only
main one I read.

I got a CSS style

..SetButton {width: 100px; background:url(mybackbutton.gif)}

now I got a table with each TD with the above class
<TABLE><TR>
<TD CLASS=SetButton>Button1
<TD CLASS=SetButton>Button2
<TD CLASS=SetButton>Button3
<TD CLASS=SetButton>Button4
<TD CLASS=SetButton>Button5
</TABLE>
it works great in IE the table is set to 500 px (100x5) and stays 500
px even when the browser width <500 px

now I also got NS 7 and test it on there

problem is:

when NS browser width <500 then it starts shrinking the table till the
text fits before it puts its bottom horizontal scroll bar on.

Now I could put a 100x1 pixel image in each cell but I dont want to do
this as the width can be variable in above style. ( the width is wrote
out by my ASP vbscript code for differnt things.

thanks for any help in advance

Al
 
A

Aaron Bertrand - MVP

Why can't the width of the image be variable? Never underestimate the
value
of a 1x1 clear .gif:

<IMG SRC="clear.gif" HEIGHT="1" WIDTH="<%=imgWidth%>">

Or, to prevent it from showing (e.g. if images are disabled and/or outlines
are on), modify the hspace / vspace parameters instead of the width /
height.
 
C

CJM

I'm 100% on what the problem is/what you are trying to do, but if you want a
proper CSS solution to this you ought to post a link so we can see the page
in action.

CJM
 
H

Harag

Thanks guys for replying but the 2 ideas you said I already thought of
and dismissed. let me explain a bit more.


I got a vbscript class that will generate html code in a table either
vertical or horizontal and in each cell it creates buttons.

now I tell the class what "style" to make these buttons so when it
creates the menu of buttons it uses the "style" for the class.

eg
<TR>
<TD ID=MainMenu_1 CLASS=MenuStyle_1_OFF onmouseover="togglemenu(this)"
onmouseout="offmenu(this)" onclick="location="file.asp">Button
Text1</TD>
<TD ID=MainMenu_2 CLASS=MenuStyle_1_OFF onmouseover="togglemenu(this)"
onmouseout="offmenu(this)" onclick="location="file.asp">Button
Text2</TD>
<TD ID=MainMenu_3 CLASS=MenuStyle_1_OFF onmouseover="togglemenu(this)"
onmouseout="offmenu(this)" onclick="location="file.asp">Button
Text3</TD>

the above is created from my asp vbscript class when i put
"clsMenu.display"

now the togglemenu code is as you might guess javascript this goes
through all the elements with the same ID (ignoring the number) and
basically turns the class of the element to the same name but adds
_OFF on the end. Then when its done that the current element ("this")
classname = the same class but with the word _ON at the end instead of
"_OFF"

the end result is that it produces 3 highlighting buttons as you move
your mouse over and only uses 2 "blank" images (rather than 6 (2 for
each button))

in my css I have 2 styles for each "look" i want one for OFF and one
for ON and thats where the "WIDTH" & "HEIGHT" is stored as well as
text color/size/weight/font etc

So really the only thing I can think of on making NS keep the cells at
the requested width was to use the width:100px; in the css but as said
before when NS browser is < width of all the buttons (due to user
resizing)

thanks for any more help.

Al
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top