Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Tue, 5 Feb 2008 15:01:04 -0500,    group: microsoft.public.inetsdk.programming.html_objmodel        back       


Firefox and display:block;   
I have the following html code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
 <head>
  <title>Firefox vs. Internet Explorer</title>
 </head>
 <body style="margin:0px;padding:0px;">
  <div style="width:100%;margin:0px;padding:0px;text-align:center;height:125px;background-color:Orange;">
   <span style="display:block;margin-top:15px;margin-bottom:15px;font-size:50px;font-weight:bold;">Firefox vs. Internet Explorer</span>
  </div>
 </body>
</html>

Here are screenshots of this code in Firefox and Internet Explorer:





As you can see, Firefox places extra space above the <div> even though both the <body> and <div> have margin:0px;padding:0px; in their style attribute. If I remove display:block; from the <span> tag's style attribute, Firefox does not display the extra space. However, because the <span> tag is nested inside the <div>, should it be necessary for me to remove the display:block; from the style attribute (I need it there so that I can specify the the margin in the span rather than the div)? Is this a bug in my code or Firefox's? Thanks.
-- 
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
date: Tue, 5 Feb 2008 15:01:04 -0500   author:   Nathan Sokalski

Re: Firefox and display:block;   
Nathan Sokalski wrote:
> 
> I have the following html code ...
>  
> ... As you can see, Firefox places extra space above the <div> even though 
> both the <body> and <div> have margin:0px;padding:0px; in their style 
> attribute. If I remove display:block; from the <span> tag's style 
> attribute, Firefox does not display the extra space. However, because 
> the <span> tag is nested inside the <div>, should it be necessary for me 
> to remove the display:block; from the style attribute (I need it there 
> so that I can specify the the margin in the span rather than the div)? 
> Is this a bug in my code or Firefox's? Thanks.

Instead of using a SPAN with display:block, just use a DIV.
date: Tue, 05 Feb 2008 15:32:38 -0500   author:   C A Upsdell cupsdell\@

Re: Firefox and display:block;   
In the application where I am trying to fix this problem, that would not 
work for the following reasons:

1. The <div> has more than just the <span> in it

2. I want to be able to set the style for the text in an element other than 
the <div>, the <div> is there simply as a container and for the background 
color

-- 
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
"C A Upsdell" <""cupsdell\"@nospam@upsdell.com"> wrote in message 
news:u1ss%23YDaIHA.3940@TK2MSFTNGP05.phx.gbl...
> Nathan Sokalski wrote:
>>
>> I have the following html code ...
>>  ... As you can see, Firefox places extra space above the <div> even 
>> though both the <body> and <div> have margin:0px;padding:0px; in their 
>> style attribute. If I remove display:block; from the <span> tag's style 
>> attribute, Firefox does not display the extra space. However, because the 
>> <span> tag is nested inside the <div>, should it be necessary for me to 
>> remove the display:block; from the style attribute (I need it there so 
>> that I can specify the the margin in the span rather than the div)? Is 
>> this a bug in my code or Firefox's? Thanks.
>
> Instead of using a SPAN with display:block, just use a DIV.
>
>
date: Tue, 5 Feb 2008 16:15:06 -0500   author:   Nathan Sokalski

Re: Firefox and display:block;   
Nathan Sokalski wrote:
> In the application where I am trying to fix this problem, that would not 
> work for the following reasons:
> 
> 1. The <div> has more than just the <span> in it
> 
> 2. I want to be able to set the style for the text in an element other than 
> the <div>, the <div> is there simply as a container and for the background 
> color

In case I did not make myself clear, I was suggesting a DIV inside a DIV 
instead of a SPAN inside a DIV.  You can add whatever you like within 
the outer DIV.
date: Tue, 05 Feb 2008 16:23:59 -0500   author:   C A Upsdell cupsdell\@

Re: Firefox and display:block;   
Start here http://msdn2.microsoft.com/en-us/ie/default.aspx and here 
http://msdn2.microsoft.com/en-us/ie/aa740476.aspx
-- 
IE General (all versions) newsgroup: 
news://msnews.microsoft.com/microsoft.public.internetexplorer.general

~Robear Dyer (PA Bear)
MS MVP-IE, Mail, Security, Windows Desktop Experience - since 2002

Nathan Sokalski wrote:
> I have the following html code...
date: Tue, 5 Feb 2008 17:29:26 -0500   author:   PA Bear [MS MVP]

RE: Firefox and display:block;   
its a bug in IE (should be fixed in version 8 as it passes the css acid 
test). firefox is correct.

with block elements, the margin (and border) are outside the object content 
area. as the div has no padding the top of the span content area lines up 
with the div's content area. but the span has a marign, so this extends 
beyound the top of the div, and pushes the div down the page.

you should read css documentation on borders, margins and padding.

-- bruce (sqlwork.com)


"Nathan Sokalski" wrote:

> I have the following html code:
> 
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml" >
>  <head>
>   <title>Firefox vs. Internet Explorer</title>
>  </head>
>  <body style="margin:0px;padding:0px;">
>   <div style="width:100%;margin:0px;padding:0px;text-align:center;height:125px;background-color:Orange;">
>    <span style="display:block;margin-top:15px;margin-bottom:15px;font-size:50px;font-weight:bold;">Firefox vs. Internet Explorer</span>
>   </div>
>  </body>
> </html>
> 
> Here are screenshots of this code in Firefox and Internet Explorer:
> 
> 
> 
> 
> 
> As you can see, Firefox places extra space above the <div> even though both the <body> and <div> have margin:0px;padding:0px; in their style attribute. If I remove display:block; from the <span> tag's style attribute, Firefox does not display the extra space. However, because the <span> tag is nested inside the <div>, should it be necessary for me to remove the display:block; from the style attribute (I need it there so that I can specify the the margin in the span rather than the div)? Is this a bug in my code or Firefox's? Thanks.
> -- 
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansokalski
date: Tue, 5 Feb 2008 14:56:09 -0800   author:   bruce barker

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us