473,402 Members | 2,064 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,402 software developers and data experts.

on IE 7, empty div will have height when width is specified

it seems that on Firefox and IE, even for standard compliance mode,
the following code will give different result:
<div style="border:1px solid orange; width:300px"></div>

on IE 7, the div will have a height of "line-height", but on Firefox
2, the div will have zero height.

When the width:300px is removed, then it is zero height on both IE 7
and Firefox 2...

any method to make them consistent? Zero height is wanted when the
database returns empty string for within the div. Thanks very much!

Jun 27 '08 #1
10 3618
Thu, 5 Jun 2008 22:14:31 -0700 (PDT), /liketofindoutwhy/:
it seems that on Firefox and IE, even for standard compliance mode,
the following code will give different result:

<div style="border:1px solid orange; width:300px"></div>

on IE 7, the div will have a height of "line-height", but on Firefox
2, the div will have zero height.

When the width:300px is removed, then it is zero height on both IE 7
and Firefox 2...

any method to make them consistent? Zero height is wanted when the
database returns empty string for within the div. Thanks very much!
Giving the DIV an explicit 'width' triggers its 'hasLayout' [1]
property in IE which makes it render quite differently from
standard-compliant.

[1] http://msdn.microsoft.com/en-us/libr...76(VS.85).aspx

--
Stanimir
Jun 27 '08 #2
In article <g2**********@registered.motzarella.org>,
Stanimir Stamenkov <s7****@netscape.netwrote:

Giving the DIV an explicit 'width' triggers its 'hasLayout' [1]
property in IE which makes it render quite differently from
standard-compliant.

[1] http://msdn.microsoft.com/en-us/libr...76(VS.85).aspx
This url appears without scrollbars in Safari 2 and iCab 4.

--
dorayme
Jun 27 '08 #3
Fri, 06 Jun 2008 16:08:47 +1000, /dorayme/:
In article <g2**********@registered.motzarella.org>,
Stanimir Stamenkov <s7****@netscape.netwrote:
>Giving the DIV an explicit 'width' triggers its 'hasLayout' [1]
property in IE which makes it render quite differently from
standard-compliant.

[1] http://msdn.microsoft.com/en-us/libr...76(VS.85).aspx

This url appears without scrollbars in Safari 2 and iCab 4.
I don't know how old Safari 2 and iCab 4 are and whether they could
turn author styles off, but given the OP has IE to try with he'll be
able to read it. I'm reading it all right using SeaMonkey 1.1.9,
Opera 9.27, Safari 3.1.1 and Lynx 2.8.6rel.5 all on Windows.

--
Stanimir
Jun 27 '08 #4
In article <g2**********@registered.motzarella.org>,
Stanimir Stamenkov <s7****@netscape.netwrote:
Fri, 06 Jun 2008 16:08:47 +1000, /dorayme/:
In article <g2**********@registered.motzarella.org>,
Stanimir Stamenkov <s7****@netscape.netwrote:
[1] http://msdn.microsoft.com/en-us/libr...76(VS.85).aspx
This url appears without scrollbars in Safari 2 and iCab 4.

I don't know how old Safari 2 and iCab 4 are and whether they could
turn author styles off, but given the OP has IE to try with he'll be
able to read it. I'm reading it all right using SeaMonkey 1.1.9,
Opera 9.27, Safari 3.1.1 and Lynx 2.8.6rel.5 all on Windows.
iCab 4 is latest, Safari 2 is not latest but is good and would not turn
off author styles. No problems with other browsers. I am not too curious
given it is MS.

--
dorayme
Jun 27 '08 #5
liketofindoutwhy wrote:
it seems that on Firefox and IE, even for standard compliance mode,
the following code will give different result:
<div style="border:1px solid orange; width:300px"></div>

on IE 7, the div will have a height of "line-height", but on Firefox
2, the div will have zero height.

When the width:300px is removed, then it is zero height on both IE 7
and Firefox 2...

any method to make them consistent? Zero height is wanted when the
database returns empty string for within the div. Thanks very much!
Ah hope that IE9 will be standards compliant? ;-)

If content is from a database, just have your server side script check
the output for content before generating the page and if there is none,
don't generate the containing DIV.

Not too advisable, but you could use JavaScript to scan the collection
of DIVs and delete or hide any without content when page loads. Then
only IE users with JavaScript disable will see the empty boxes.

Or lastly, live with the empty boxes on IE...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Jun 27 '08 #6
hm, it seems like there are 2 solutions:

1) don't show the div at all when the string is empty by using PHP
(the border was only for debug purpose and not needed)

2) or, this div is inside another div with width of 600px, so i can
set this inner div to have no width, but just a margin-right of 50px
or something like that.

I tested both solutions and they worked in both IE 7 and Firefox 2.

Jun 27 '08 #7
so dorayme is in austalia? do you get to play a lot of sports
there? what do you do over the weekends?
Jun 27 '08 #8
In article
<b1**********************************@m45g2000hsb. googlegroups.com>,
liketofindoutwhy <li**************@gmail.comwrote:
so dorayme is in austalia? do you get to play a lot of sports
there?
No, I played more sport when I was in England, in bad weather and clouds
and snow and my right foot still has big boney top where soccer ball
kept hitting it and flying off at great speed, sometimes into net and me
pleased and team pleased and 9 out of crowd of 18 people pleased...
what do you do over the weekends?
I cry and drink a lot of tea.

--
dorayme
Jun 27 '08 #9
On Jun 6, 3:41 pm, dorayme <doraymeRidT...@optusnet.com.auwrote:
In article
<b14f11f7-f62f-480d-bdaf-069dd919c...@m45g2000hsb.googlegroups.com>,

liketofindoutwhy <liketofindout...@gmail.comwrote:
so dorayme is in austalia? do you get to play a lot of sports
there?

No, I played more sport when I was in England, in bad weather and clouds
and snow and my right foot still has big boney top where soccer ball
kept hitting it and flying off at great speed, sometimes into net and me
pleased and team pleased and 9 out of crowd of 18 people pleased...
what do you do over the weekends?

I cry and drink a lot of tea.
do how come you cry in the weekends? for one thing, you know CSS well
and seems to enjoy life.
Jun 27 '08 #10
In article
<57**********************************@l64g2000hse. googlegroups.com>,
liketofindoutwhy <li**************@gmail.comwrote:
On Jun 6, 3:41 pm, dorayme wrote:
liketofindoutwhy wrote:
....
what do you do over the weekends?
I cry and drink a lot of tea.

do how come you cry in the weekends? for one thing, you know CSS well
and seems to enjoy life.
Because, on the weekends, I feel like one or the other of two people who
enjoyed life but who were finished off by the brute, Zampanò in the
film, La Strada. Namely, Gelsomina and Il 'Matto'-The 'Fool'.

--
dorayme
Jun 27 '08 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: KathyB | last post by:
Hi, I'm trying to find a way to validate input text boxes where I don't know the names until the page is rendered. I've got 2 validate functions that fire with the onsubmit button of a "mini" form...
7
by: Mark | last post by:
Hi - could anyone please tell me why this line: <td width="116" height="22" nowrap id="toptSearch" class="mtTabOnTop" onClick="changeLoc('fixit_proceduresresultstick.asp','search')">Search <img...
2
by: David D. | last post by:
If an <IMG> specifies a WIDTH but not a HEIGHT, then height is internally determined so as to maintain the image's aspect ratio. Aspect ratio is also preserved if HEIGHT but not WIDTH is...
5
by: Secret Guy | last post by:
Because of my experience posting various places over the last couple of weeks: I'm expecting to be greated with hostility for asking about concepts instead of "practical" things, since that has...
5
by: Greg N. | last post by:
Hi folks, I have a table cell with a background image, something like <td background=landscape.jpg height=200></td> The sole purpose of this code is to display the image inside that table...
4
by: Jim Moe | last post by:
Hello, Mozilla (suite and Firefox) ignore the height and width attributes of <img> when the image itself is unavailable (404); only enough space is allocated for the alt text. Is this expected...
5
by: Brent | last post by:
Take this small HTML fragment: span.theClass{float:left;width:100px;cursor:pointer;cursor:hand;} ------------------------ <div> <span id="1" class="theClass">&nbsp;<span> <span id="2"...
8
by: Massimiliano | last post by:
Hi all. How I can retreive a dimension in pixel of a character draw with graphics.drawstring(...). For example: imgFont = New Bitmap(48, 48) ' for now the dimension is fixed g =...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.