473,602 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="backgrou nd-color:LightSlat eGray;"><span
style="display: inline-block;backgroun d-color:Red;width :50px;"></span></td>

And here the code-behind:
--------------------------
c = New TableCell
c.HorizontalAli gn = HorizontalAlign .Left
c.BackColor = Drawing.Color.L ightSlateGray
l = New Label
l.BackColor = Drawing.Color.R ed
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 1654
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="backgrou nd-color:LightSlat eGray;"><span
style="display: inline-block;backgroun d-color:Red;width :50px;"></span></td>

And here the code-behind:
--------------------------
c = New TableCell
c.HorizontalAli gn = HorizontalAlign .Left
c.BackColor = Drawing.Color.L ightSlateGray
l = New Label
l.BackColor = Drawing.Color.R ed
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.co mschreef in bericht
news:Ot******** ******@TK2MSFTN GP05.phx.gbl...
André wrote:
>Hi,

i created a table with cells. One cell has background-color
(LightSlateGra y) and contains a label without text but also with a
backgroundcolo r (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
(LightSlateGra y) 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="backgrou nd-color:LightSlat eGray;"><span
style="display :inline-block;backgroun d-color:Red;width :50px;"></span></td>

And here the code-behind:
--------------------------
c = New TableCell
c.HorizontalAl ign = HorizontalAlign .Left
c.BackColor = Drawing.Color.L ightSlateGray
l = New Label
l.BackColor = Drawing.Color.R ed
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.dfwr ote:
Thanks for replying.
Do you mean there is no solution for this problem?

"Göran Andersson" <gu...@guffa.co mschreef in berichtnews:Ot* *************@T K2MSFTNGP05.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="backgrou nd-color:LightSlat eGray;"><span
style="display: inline-block;backgroun d-color:Red;width :50px;"></span></td>
And here the code-behind:
--------------------------
c = New TableCell
c.HorizontalAli gn = HorizontalAlign .Left
c.BackColor = Drawing.Color.L ightSlateGray
l = New Label
l.BackColor = Drawing.Color.R ed
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:bl ock" together with
"float:left " (or "float:righ t")

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******** *************** ***********@a70 g2000hsh.google groups.com...
On Jun 19, 12:28 pm, "André" <ss...@nol.dfwr ote:
Thanks for replying.
Do you mean there is no solution for this problem?

"Göran Andersson" <gu...@guffa.co mschreef in
berichtnews:Ot* *************@T K2MSFTNGP05.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="backgrou nd-color:LightSlat eGray;"><span
style="display: inline-block;backgroun d-color:Red;width :50px;"></span></td>
And here the code-behind:
--------------------------
c = New TableCell
c.HorizontalAli gn = HorizontalAlign .Left
c.BackColor = Drawing.Color.L ightSlateGray
l = New Label
l.BackColor = Drawing.Color.R ed
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:bl ock" together with
"float:left " (or "float:righ t")

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
6605
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 ;) input.example { background-color: #fff } and the javascript:
1
14152
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 it. If I use tdRef.bgColor to set/read the value, I always get #rrggbb regardless of whether I've used rgb(...) or #rrggbb. IE, on the other hand, when using style.backgroundColor reports back in whatever format was used (either rgb(...) or...
13
6062
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 mozilla. go figure.
2
4813
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" maxlength="3" id="someID" style="width:30px;" /> Notice the gets rendered as . This causes
10
2354
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 = navigator.appName;
1
2220
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: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_15507 all three browers successfully run the Flash movie and show the same version of Flash to be installed. However, if I try to use a javascript Flash detection solution, it does
6
10704
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 graphic, with CSS only. the product is finished. whenever i select a color, its color will be displayed in a box whose id name is contained in variable "color_box" and the equivalent color value will appear in a text box with id contained in the variable...
10
2236
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, and also setting it for each of the List Items. The resulting .html code looks correct. Why doesn't the color display? Code DropDownListWorkLocation.BackColor = System.Drawing.Color.PowderBlue;
1
1533
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, Netscape, Firefox ...., but with IE6, there are big gaps between the radiobuttonlists. I looked at the source of both browser versions, but there is no difference. The difference is in the way of rendering the html code.
0
7993
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8401
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8268
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6730
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5867
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3900
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.