HighDots Forums  

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

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss on IE 7, empty div will have height when width is specified in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
liketofindoutwhy
 
Posts: n/a

Default on IE 7, empty div will have height when width is specified - 06-06-2008 , 12:14 AM






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!


Reply With Quote
  #2  
Old   
Stanimir Stamenkov
 
Posts: n/a

Default Re: on IE 7, empty div will have height when width is specified - 06-06-2008 , 12:46 AM






Thu, 5 Jun 2008 22:14:31 -0700 (PDT), /liketofindoutwhy/:

Quote:
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


Reply With Quote
  #3  
Old   
dorayme
 
Posts: n/a

Default Re: on IE 7, empty div will have height when width is specified - 06-06-2008 , 01:08 AM



In article <g2aiuu$911$1 (AT) registered (DOT) motzarella.org>,
Stanimir Stamenkov <s7an10 (AT) netscape (DOT) net> wrote:


Quote:
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


Reply With Quote
  #4  
Old   
Stanimir Stamenkov
 
Posts: n/a

Default Re: on IE 7, empty div will have height when width is specified - 06-06-2008 , 01:34 AM



Fri, 06 Jun 2008 16:08:47 +1000, /dorayme/:
Quote:
In article <g2aiuu$911$1 (AT) registered (DOT) motzarella.org>,
Stanimir Stamenkov <s7an10 (AT) netscape (DOT) net> wrote:

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


Reply With Quote
  #5  
Old   
dorayme
 
Posts: n/a

Default Re: on IE 7, empty div will have height when width is specified - 06-06-2008 , 02:19 AM



In article <g2alot$hjg$1 (AT) registered (DOT) motzarella.org>,
Stanimir Stamenkov <s7an10 (AT) netscape (DOT) net> wrote:

Quote:
Fri, 06 Jun 2008 16:08:47 +1000, /dorayme/:
In article <g2aiuu$911$1 (AT) registered (DOT) motzarella.org>,
Stanimir Stamenkov <s7an10 (AT) netscape (DOT) net> wrote:

[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


Reply With Quote
  #6  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: on IE 7, empty div will have height when width is specified - 06-06-2008 , 09:33 AM



liketofindoutwhy wrote:
Quote:
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


Reply With Quote
  #7  
Old   
liketofindoutwhy
 
Posts: n/a

Default Re: on IE 7, empty div will have height when width is specified - 06-06-2008 , 05:15 PM



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.


Reply With Quote
  #8  
Old   
liketofindoutwhy
 
Posts: n/a

Default Re: on IE 7, empty div will have height when width is specified - 06-06-2008 , 05:17 PM



so dorayme is in austalia? do you get to play a lot of sports
there? what do you do over the weekends?

Reply With Quote
  #9  
Old   
dorayme
 
Posts: n/a

Default Re: on IE 7, empty div will have height when width is specified - 06-06-2008 , 05:41 PM



In article
<b14f11f7-f62f-480d-bdaf-069dd919c2a2 (AT) m45g2000hsb (DOT) googlegroups.com>,
liketofindoutwhy <liketofindoutwhy (AT) gmail (DOT) com> wrote:

Quote:
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...

Quote:
what do you do over the weekends?
I cry and drink a lot of tea.

--
dorayme


Reply With Quote
  #10  
Old   
liketofindoutwhy
 
Posts: n/a

Default Re: on IE 7, empty div will have height when width is specified - 06-06-2008 , 06:09 PM



On Jun 6, 3:41 pm, dorayme <doraymeRidT... (AT) optusnet (DOT) com.au> wrote:
Quote:
In article
b14f11f7-f62f-480d-bdaf-069dd919c... (AT) m45g2000hsb (DOT) googlegroups.com>,

liketofindoutwhy <liketofindout... (AT) gmail (DOT) com> wrote:
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.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.