Label background in Mozilla with embedded html

Discussion in 'ASP .Net' started by NancyASAP, May 29, 2005.

  1. NancyASAP

    NancyASAP Guest

    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
    NancyASAP, May 29, 2005
    #1
    1. Advertising

  2. NancyASAP

    TJS Guest

    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




    "NancyASAP" <> wrote in message
    news:...
    >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
    >
    TJS, May 29, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shapper
    Replies:
    2
    Views:
    732
    Scott Mitchell [MVP]
    May 7, 2005
  2. Josef K.

    <label><div></div></label> allowed?

    Josef K., May 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    13,407
    Josef K.
    May 22, 2005
  3. Henri
    Replies:
    9
    Views:
    1,836
    Toby Inkster
    Feb 22, 2005
  4. Praveen
    Replies:
    1
    Views:
    966
    Rob Williscroft
    Nov 5, 2006
  5. Knut Krueger
    Replies:
    8
    Views:
    265
    Knut Krueger
    Aug 20, 2013
Loading...

Share This Page