Label background in Mozilla with embedded html

N

NancyASAP

I have a label on my ASP.NET form. It has a cssclass that includes a
background color.

I am dynamically putting text in this label. The text contains some
embedded html (I want to display part of label contents as a list so it
uses <ul> and <li>). The format of the string assigned to label text
looks like this:
"An error occurred:<ul><li>message 1</li><li>message2</li></ul>"

The label renders in both browsers the same. Here's the actual
rendering from Mozilla, with some of text missing for brevity:

<span id="lblValidateMessages" class="validationsummary">Doc is
invalid. Validation indicates these errors: <ul><li>Forceable error #3:
Activity Id.</li><li>Forceable error #5: WPD Id</li><li>Non-forceable
error #99: Doc Thru Date</li></ul></span>

This renders great in IE 6. In Mozilla 1.73, only the first line of the
label has a background color. As soon as it reaches the embedded <ul>,
the background color turns off.

I have played around with using a literal control instead, but for
various reasons I decided not to use it (esp. since it doesn't have a
cssclass attribute).

Interestingly, when I change the string to include a "class" attribute
on the <ul> tag <ul class='validationsummary'>, in Mozilla I get the
all text inside the <ul> in the correct bgcolor, but I ALSO get a
vertical space of about one line width before the <ul> text WITHOUT the
background color.

I'm sure this is just another browser-specific css rendering problem...
but any ideas on how to correct this?
Thanks!
NancyASAP
 
T

TJS

try using a literal tag and wrap the literal in a div tag so you can assign
a css class.

A label tag automatically assigns a span tag,( a literal does not), and I
suspect the span tag does not always cross over other html tags for all
browsers.

A div tag should do the trick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top