You are here: Re: div with background color not rendering in Firefox, but renders in IE. « HTML « IT news, forums, messages
Re: div with background color not rendering in Firefox, but renders in IE.

Posted by Jonathan N. Little on 06/11/07 14:31

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:
>
> <div style="background-color:#000000; width: 50px;" />
> ...
> <div style="background-color:#000000; width: 75px;" />
>
> 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:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-language" content="en-us">


<title>Bar Chart</title>

<style type="text/css">
DIV { height: 10px; background-color:#000000; }
</style>

</head>
<body>

<div style="width: 50px;"></div>

<div style="width: 75px;"></div>

</body>
</html>


--
Take care,

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация