472,958 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

FireFox CSS - overflow:hidden with vertical-align

I need to get the right combination for a div to clip any text inside and allow vertical alignment. I only have this problem in FireFox. I have 3 divs nested within each other. The outer div has display of table, the first inner div has display of table-cell and the inner-most div has the text. The outer div has a set width and height.

So here's the problem:
  • Without the inner divs having a width and height set, the overflow:hidden doesn't clip; the text causes the div to stretch.
  • If I assign the inner divs a width and height of 100% then it doesn't stretch, but vertical-align doesn't work anymore.
  • If i assign the inner divs a width and height equal to the outer div, it not only is not vertically aligned, it makes the div bigger than it should be.
Here's the code:
[html]<!-- With inner div width set -->
<div id="outerDiv" style="font-style:normal;left:0px;text-align:Left;width:200px;font-weight:normal;height:200px;position:Relative;top:0 px;display:table;color:#000000;font-family:Arial;border:#000000 Solid 1px;background-color:#ffffff;overflow:hidden;font-size:12pt;">
<div id="ltoPreview_nest1" style="display:table-cell;vertical-align:Top;overflow:hidden;width:100%;height:100%;" >
<div id="ltoPreview_nest2" style="overflow:hidden;width:100%;height:100%;text-decoration:none;">Text Goes Here</div>
</div>
</div>[/html]
[html]
<!-- Without inner div width set -->
<div id="outerDiv" style="font-style:normal;left:0px;text-align:Left;width:200px;font-weight:normal;height:200px;position:Relative;top:0 px;display:table;color:#000000;font-family:Arial;border:#000000 Solid 1px;background-color:#ffffff;overflow:hidden;font-size:12pt;">
<div id="ltoPreview_nest1" style="display:table-cell;vertical-align:Top;overflow:hidden;">
<div id="ltoPreview_nest2" style="overflow:hidden;text-decoration:none;">Text Goes Here</div>
</div>
</div>[/html]
Aug 25 '07 #1
2 15445
Okay, I figured out a way around this. It uses a table, but it works.

Vertical-align is designed for table cells, that is why there must be a div with a display: table and a nested one with display: table-cell. Then all items inside the table-cell div will be aligned vertically (the vertical-align style must be on the same div as the table-cell).

Well, I figured since it is designed for table cells, maybe it would work better on a real table cell, and it does! Here's the stripped down code that clips and keeps dimensions:

[html]
<div style="position:absolute; left:200px; width:50px; height:100px; top:50px; border: 1px solid black; overflow:hidden;">
<table width=100% height=100%>
<tr>
<td style="vertical-align:middle">Text goes here</td>
</tr>
</table>
</div>
[/html]
Aug 25 '07 #2
drhowarddrfine
7,435 Expert 4TB
Vertical-align is designed for table cells
No, it's designed for table cells and inline elements.
Aug 26 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Charles Blaquière | last post by:
As part of my explorations in liquid design, I'm exploring ways to use the overflow: hidden property -- when browser windows become too narrow, I want (some) images to get cropped rather than have...
6
by: Kai Grossjohann | last post by:
I have a frame which is supposed to contain a list of links. The clickable area of each link comprises a picture followed by some text. I want the text to be cut at the right hand side when the...
0
by: waste | last post by:
Hello! This simple code won't work with IE. Can somebody iluminate me: why? Is it IE bug? I write it to gain possibility to move a layer (with JavaScreipt), but only within a parent (not...
2
by: SolarCanine | last post by:
Specifically, assume I have a div tag of absolute dimensions. I need to figure out, first, whether or not the text inside the div tag is partially hidden by the overflow setting, and if so, what...
2
by: stefanomnn | last post by:
hello, i have a tetxtarea, with the style overflow:hidden, and a long text. because of the overflow, user does not see the whole text but a part. is there, in an IE browser, a mode to...
2
by: SAL | last post by:
I have the following line of code in my Page_Load Event of my ASP.net page: txtExplanationofChange.Attributes.Add ("style","overflow :hidden"); which allows me to can turn off the Scrollbar of my...
1
by: mattalexx | last post by:
For some reason, I can't post a reply on http://www.thescripts.com/forum/thread153857.html , so I'll post one here. There is, in fact, a way to appy an overflow: hidden to a td.. <table...
5
by: Christopher Night | last post by:
I'm making a Javascript program that uses overflow:hidden on a containing div to crop an image. This page (temporarily) shows an example of what I mean: ...
4
by: zzpat | last post by:
I have a box element that uses overflow: hidden and I want a link which at the bottom of the element to be visible. I can't make the link visible. Obviously I'm having problems so I was...
3
by: wyatt | last post by:
Hi, I have noted in IE7 that, when the body of a page is given the property overflow:hidden, it can still be scrolled by selecting some of the text on the page and, with the mouse button still...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.