asp.net - Applying html formating in label control -
HTML formatting has been implemented great in this case. The nickname is displayed with 5 sizes.
lblWelcome.Text = "Welcome: & lt; font size = '' 5 '' & gt;" & Amp; TxtSurname.Text & amp; "& Lt; / font & gt;"
Why is the HTML style not implemented in this example?
lblWelcome.Text = "Welcome: & lt; font color = 'white' '& gt;" & Amp; TxtSurname.Text & amp; "& Lt; / font & gt;"
Please, please do not use font tags. In addition, if you really want to output HTML from the server side, then you should use a little control.
Here's an example of how I do it:
aspx / ascx file:
Welcome:
Behind the code:
lit1.Text = "& lt; span class = 'welcome' & gt; & Amp; TxtSurname.Text & amp; "From & lt; / span & gt;"
Or your other example:
lit1.Text = "& lt; span class = 'welcomebig' & gt; & Amp; TxtSurname.Text & amp; "From & lt; / span & gt;"
CSS:
span.welcome {color: #fff; } Span.welcomeBig {font-size: 24px; }
Hope this helps
Comments
Post a Comment