473,416 Members | 1,849 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 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 15522
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.