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

backgroundcolor not rendered with Netscape, Firefox

Hi,

i created a table with cells. One cell has background-color (LightSlateGray)
and contains a label without text but also with a backgroundcolor (red). The
width of the label is set by a value which represents a percentage of
another value (doesn't matter).

In IE, it works: i see the background of the cell and the red background of
the label.
In Netscape, Safari, Firefox, i only see the backgroundcolor of the cell
(LightSlateGray) but not the red background of the label.

Any idea how to solve this?
Thanks
André

Here the source of the file sent to the browser:
---------------------------------------------

<td align="left" style="background-color:LightSlateGray;"><span
style="display:inline-block;background-color:Red;width:50px;"></span></td>

And here the code-behind:
--------------------------
c = New TableCell
c.HorizontalAlign = HorizontalAlign.Left
c.BackColor = Drawing.Color.LightSlateGray
l = New Label
l.BackColor = Drawing.Color.Red
If aantalantw(j) 0 Then
l.Width = Math.Round((va(j, k) / aantalantw(j)) * 100, 1)
Else
l.Width = 0
End If
c.Controls.Add(l)
Jun 27 '08 #1
4 1644
André wrote:
Hi,

i created a table with cells. One cell has background-color (LightSlateGray)
and contains a label without text but also with a backgroundcolor (red). The
width of the label is set by a value which represents a percentage of
another value (doesn't matter).

In IE, it works: i see the background of the cell and the red background of
the label.
In Netscape, Safari, Firefox, i only see the backgroundcolor of the cell
(LightSlateGray) but not the red background of the label.

Any idea how to solve this?
Thanks
André

Here the source of the file sent to the browser:
---------------------------------------------

<td align="left" style="background-color:LightSlateGray;"><span
style="display:inline-block;background-color:Red;width:50px;"></span></td>

And here the code-behind:
--------------------------
c = New TableCell
c.HorizontalAlign = HorizontalAlign.Left
c.BackColor = Drawing.Color.LightSlateGray
l = New Label
l.BackColor = Drawing.Color.Red
If aantalantw(j) 0 Then
l.Width = Math.Round((va(j, k) / aantalantw(j)) * 100, 1)
Else
l.Width = 0
End If
c.Controls.Add(l)
The display value inline-block is part of the CSS 2.1 standard, so it's
not implemented in all current browsers. The implementation in IE7 is
only partial, and Firefox 2 doesn't support it at all.

As Firefox doesn't recognise the inline-block setting, the span is still
an inline element. You can't specify a width for inline elements, so as
there isn't anything in the span, it will not take up any space. The
background color works just fine, you just don't see it.

--
Göran Andersson
_____
http://www.guffa.com
Jun 27 '08 #2
Thanks for replying.
Do you mean there is no solution for this problem?
"Göran Andersson" <gu***@guffa.comschreef in bericht
news:Ot**************@TK2MSFTNGP05.phx.gbl...
André wrote:
>Hi,

i created a table with cells. One cell has background-color
(LightSlateGray) and contains a label without text but also with a
backgroundcolor (red). The width of the label is set by a value which
represents a percentage of another value (doesn't matter).

In IE, it works: i see the background of the cell and the red background
of the label.
In Netscape, Safari, Firefox, i only see the backgroundcolor of the cell
(LightSlateGray) but not the red background of the label.

Any idea how to solve this?
Thanks
André

Here the source of the file sent to the browser:
---------------------------------------------

<td align="left" style="background-color:LightSlateGray;"><span
style="display:inline-block;background-color:Red;width:50px;"></span></td>

And here the code-behind:
--------------------------
c = New TableCell
c.HorizontalAlign = HorizontalAlign.Left
c.BackColor = Drawing.Color.LightSlateGray
l = New Label
l.BackColor = Drawing.Color.Red
If aantalantw(j) 0 Then
l.Width = Math.Round((va(j, k) / aantalantw(j)) * 100, 1)
Else
l.Width = 0
End If
c.Controls.Add(l)

The display value inline-block is part of the CSS 2.1 standard, so it's
not implemented in all current browsers. The implementation in IE7 is only
partial, and Firefox 2 doesn't support it at all.

As Firefox doesn't recognise the inline-block setting, the span is still
an inline element. You can't specify a width for inline elements, so as
there isn't anything in the span, it will not take up any space. The
background color works just fine, you just don't see it.

--
Göran Andersson
_____
http://www.guffa.com

Jun 27 '08 #3
On Jun 19, 12:28 pm, "André" <ss...@nol.dfwrote:
Thanks for replying.
Do you mean there is no solution for this problem?

"Göran Andersson" <gu...@guffa.comschreef in berichtnews:Ot**************@TK2MSFTNGP05.phx.gbl. ..
André wrote:
Hi,
i created a table with cells. One cell has background-color
(LightSlateGray) and contains a label without text but also with a
backgroundcolor (red). The width of the label is set by a value which
represents a percentage of another value (doesn't matter).
In IE, it works: i see the background of the cell and the red background
of the label.
In Netscape, Safari, Firefox, i only see the backgroundcolor of the cell
(LightSlateGray) but not the red background of the label.
Any idea how to solve this?
Thanks
André
Here the source of the file sent to the browser:
---------------------------------------------
<td align="left" style="background-color:LightSlateGray;"><span
style="display:inline-block;background-color:Red;width:50px;"></span></td>
And here the code-behind:
--------------------------
c = New TableCell
c.HorizontalAlign = HorizontalAlign.Left
c.BackColor = Drawing.Color.LightSlateGray
l = New Label
l.BackColor = Drawing.Color.Red
If aantalantw(j) 0 Then
l.Width = Math.Round((va(j, k) / aantalantw(j)) * 100, 1)
Else
l.Width = 0
End If
c.Controls.Add(l)
The display value inline-block is part of the CSS 2.1 standard, so it's
not implemented in all current browsers. The implementation in IE7 is only
partial, and Firefox 2 doesn't support it at all.
As Firefox doesn't recognise the inline-block setting, the span is still
an inline element. You can't specify a width for inline elements, so as
there isn't anything in the span, it will not take up any space. The
background color works just fine, you just don't see it.
--
Göran Andersson
_____
http://www.guffa.com
If the label is the only element within the cell then just set the
label's display property to "block".
If there are several elements than use "display:block" together with
"float:left" (or "float:right")

Label l = new Label()
l.Style["display"] = "block";
l.Style["float"] = "left"; //optional

Code in C#, I do not remember VB syntax :(

Mykola
http://marss.co.ua
Jun 27 '08 #4
Thanks

"marss" <ma******@gmail.comschreef in bericht
news:76**********************************@a70g2000 hsh.googlegroups.com...
On Jun 19, 12:28 pm, "André" <ss...@nol.dfwrote:
Thanks for replying.
Do you mean there is no solution for this problem?

"Göran Andersson" <gu...@guffa.comschreef in
berichtnews:Ot**************@TK2MSFTNGP05.phx.gbl. ..
André wrote:
Hi,
i created a table with cells. One cell has background-color
(LightSlateGray) and contains a label without text but also with a
backgroundcolor (red). The width of the label is set by a value which
represents a percentage of another value (doesn't matter).
In IE, it works: i see the background of the cell and the red
background
of the label.
In Netscape, Safari, Firefox, i only see the backgroundcolor of the
cell
(LightSlateGray) but not the red background of the label.
Any idea how to solve this?
Thanks
André
Here the source of the file sent to the browser:
---------------------------------------------
<td align="left" style="background-color:LightSlateGray;"><span
style="display:inline-block;background-color:Red;width:50px;"></span></td>
And here the code-behind:
--------------------------
c = New TableCell
c.HorizontalAlign = HorizontalAlign.Left
c.BackColor = Drawing.Color.LightSlateGray
l = New Label
l.BackColor = Drawing.Color.Red
If aantalantw(j) 0 Then
l.Width = Math.Round((va(j, k) / aantalantw(j)) * 100, 1)
Else
l.Width = 0
End If
c.Controls.Add(l)
The display value inline-block is part of the CSS 2.1 standard, so it's
not implemented in all current browsers. The implementation in IE7 is
only
partial, and Firefox 2 doesn't support it at all.
As Firefox doesn't recognise the inline-block setting, the span is still
an inline element. You can't specify a width for inline elements, so as
there isn't anything in the span, it will not take up any space. The
background color works just fine, you just don't see it.
--
Göran Andersson
_____
http://www.guffa.com
If the label is the only element within the cell then just set the
label's display property to "block".
If there are several elements than use "display:block" together with
"float:left" (or "float:right")

Label l = new Label()
l.Style["display"] = "block";
l.Style["float"] = "left"; //optional

Code in C#, I do not remember VB syntax :(

Mykola
http://marss.co.ua
Jun 27 '08 #5

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

Similar topics

1
by: Philip | last post by:
Hey, Is it possible to get the default value of an element's style.backgroundColor property that's set in a css class? Example, since I'm very tired and can't word that any better ;) ...
1
by: RobG | last post by:
When I set the background colour of an element using tdRef.style.backgroundColor and then read it back, Firefox always gives rgb(r, g, b) regardless of whether I've used rgb(...) or #rrggbb to set...
13
by: cosmic foo | last post by:
if i change the backgroundColor of a tag to 'red', it works in both ie and mozilla. if i change the backgroundColor of a tag to 'redd', i get 'invalid property value' in ie, and no error in...
2
by: Jeff | last post by:
Using ASP.NET 1.1 I have an <asp:TextBox... for which I set the width property --- "width=30". The textbox is being rendered to the browser like this: <input name="someName" type="text"...
10
by: News | last post by:
I have a page up trying to learn how to ID a browser and other info. http://wyght.com/warren/testPos.html here is the code <script type = "text/javascript"> var space = ", "; var name...
1
by: dscriv | last post by:
Hello, I have Netscape 8.0.4 (in Firefox mode) and Flash 8.0.24.0. I also have IE and Firefox installed. If I go to this page, which contains a Flash detection movie:...
6
by: fallen angel | last post by:
halu there!! i'm a 1month experienced java scripter but got a good hang of it already. hehehe.. i developed a "color selection" tool, similar to the one in flash when you choose a color for a...
10
by: Cliff Cotterill | last post by:
I've tried multiple ways of setting the background-color of a DropDownList, but none seem to work. How can the color be set? I've tried setting the BackGroundColor of the DrowDownList component,...
1
by: Mich | last post by:
Hi, i made an application where a lot of radiobuttonlists are created dynamically. Some are visible and others are hidden until the right selectedvalue is chosen. Thsi works perfectly with IE7,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.