div with background color not rendering in Firefox, but renders in IE.

div with background color not rendering in Firefox, but renders in IE.

am 11.06.2007 15:58:59 von kaczmar2

Hello,

I am trying to make a simple bar chart for a web page. For this, I
need to calculate the widths of divs in pixels, and then display
them. They have no text content; I just need them to show up and
colored bars. The code is like this:


....


This shows up no problem in IE6+, but not in Firefox 2.

If I put text content in the div, it displays, but it sizes to just
fit the content. (This follows from the CSS documentation of
"display:inline";) but I need to show the absolute size in pixels

Any clues as to how to get the div to show up with the background
color?

Thanks.

Re: div with background color not rendering in Firefox, but renders in IE.

am 11.06.2007 16:14:47 von dorward

On Jun 11, 2:58 pm, kaczm...@gmail.com wrote:

> I am trying to make a simple bar chart for a web page. For this, I
> need to calculate the widths of divs in pixels, and then display
> them.

Oh boy. HTML isn't designed for drawing diagrams with. For this sort
of thing I'd look to images (or maybe Flash).

> They have no text content; I just need them to show up and
> colored bars. The code is like this:
>
>



That looks like XHTML which doesn't conform to Appendix C. If you're
serving it as text/html then anything can happen and you really should
stop. If you're serving it as XHTML, then IE should be prompting you
to download it.

So I'm guessing you're doing the former. Write HTML instead, or at
least follow the HTML compatibility guidelines.

Also, as always, a real URL is better then tiny fragments of a
document. So much depends on context, that document fragments are all
but worthless for debugging code.

--
David Dorward
http://dorward.me.uk/

Re: div with background color not rendering in Firefox, but renders in IE.

am 11.06.2007 16:31:14 von lws4art

kaczmar2@gmail.com wrote:
> Hello,
>
> I am trying to make a simple bar chart for a web page. For this, I
> need to calculate the widths of divs in pixels, and then display
> them. They have no text content; I just need them to show up and
> colored bars. The code is like this:
>
>


> ...
>

>
> This shows up no problem in IE6+, but not in Firefox 2.
>
> If I put text content in the div, it displays, but it sizes to just
> fit the content. (This follows from the CSS documentation of
> "display:inline";) but I need to show the absolute size in pixels
>
> Any clues as to how to get the div to show up with the background
> color?

Simple! What's the height? You did not specify and Firefox wasn't about
to guess. Here it is in HTML:

"http://www.w3.org/TR/html4/strict.dtd">






Bar Chart














--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Re: div with background color not rendering in Firefox, but renders in IE.

am 11.06.2007 18:26:15 von kaczmar2

Thank you all for your suggestions...

adding the "height" attribute to the style of the div did work and
allowed the div to display in both IE and FF.

I can understand the suggestion of not using HTML for charting. I can
create a 1 pixel wide image of a specific height and any desired with,
and render it out that was as well.

Thanks again.

On Jun 11, 9:58 am, kaczm...@gmail.com wrote:
> Hello,
>
> I am trying to make a simple bar chart for a web page. For this, I
> need to calculate the widths of divs in pixels, and then display
> them. They have no text content; I just need them to show up and
> colored bars. The code is like this:
>
>


> ...
>

>
> This shows up no problem in IE6+, but not in Firefox 2.
>
> If I put text content in the div, it displays, but it sizes to just
> fit the content. (This follows from the CSS documentation of
> "display:inline";) but I need to show the absolute size in pixels
>
> Any clues as to how to get the div to show up with the background
> color?
>
> Thanks.