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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get the Overflow:Hidden to work correctly? 1

Status
Not open for further replies.

jsteph

Technical User
Oct 24, 2002
2,562
US
Hi all,
I'm generating an HTML Table, and I want to keep very strict column widths. The code is pretty simple--a <table> with trs and tds. I have a Width and Height style set for the tds, and Overflow:Hidden set for the tds.

Yet when rendered (in ie7, I havn't checked other browsers) it *always* just totally ignores my column widths and sets each column to the longest data row for that column. Is it possible I've constructed the html poorly, or is this one of those quirks that I just have to live with? Thanks,
--Jim
 
You can't use overflow:hidden on table cells its not supported. You would need to insert a DIV inside each cell and give the overflow:hidden to the DIV which is not recommended either but at least it does work as expected..

Now unless the table actually contains tabular data, you should not be using it at all.

----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Keith,vacunita,
The data is just basic tablular data--customer names, dates, amounts.

Dan,
That table-layout:fixed seems to have some effect but I think I stepped on it and checked my code and I'm embedding a text-type input inside the td. I had seen this done elsewhere and recall reading that it gave one more control over the contents, formatting-wise.

Does that sound correct? Is it a best-practice to embedd an input in a td for general tabular data? Or is a plain td a sufficient method. I just got in the habit of using the input and quite honestly I can't recall the logic behind that decision right now.
Thanks for any advice,
--Jim
 
Are these inputs there for the user to provide input? Then yes, you can use them in a table. Or are these inputs there just to hold the text? Then no, you should not be using them.

___________________________________________________________
[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
Embedding the input could be the cause of your initial column width problem where the input box would force the column width to the input's width. With nothing squeezing into your cells, the widths you state should render correctly.

Keith
 
That is a good point about the inputs--and I now remember the original intent of the inputs. The generator I built was originally used for a data input/display, and I'd been using it to build this readonly table.

I'll remove the inputs and report what happens,
Thanks,
--Jim

 
Vragabond,
Yes, thanks, it was the inputs...they seem to force their will on the td's. I removed them and applied the formatting to the td's and it's looking sharp now,
--Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top