changing <span> forecolor

J

Juan T. Llibre

Since a Label is rendered as a SPAN, you could create a Label
web control whose ForeColor property is set programatically.

If a Label's Forecolor is set to Red and the browser is IE,
the following HTML 4.0 markup will be rendered :

<span id="controlID" style="color: red">Label Text</span>

If, however, the visitor uses Netscape 4.x, they'll get HTML 3.2-compliant markup.

The HTML for the Label web control would specify the color
using a <font> element rather than a style attribute in the <span> :

<span id="controlID"><font color="red">Label Text</font></span>
 
S

Siva M

Another option is to add runat=server and an ID=spanID attibutes to the span
tag. Then access the color style as spanID.Style["color"] = "red"

Is it possible to change the forecolor of a Span programmatically?


Cheers,

Mike
 

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

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top