Click here to Skip to main content
15,900,108 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to assign a red color to the first character 'c' of the text in the following code:

XML
<asp:Label ID="logofoodygoody" runat="server" Text= "chittoor.net"  ForeColor="Black"  Font-Bold=true Font-Size="XX-Large"
   style="font-family:Arial Narrow; margin-top:3px;  position:absolute; text-shadow: 1px 3px  Ghostwhite; font-weight:normal">
    </asp:Label>


I tried with span but did not work.
Posted
Comments
Prasad Avunoori 27-Jun-14 1:11am    
Why don't you use div?
Sergey Alexandrovich Kryukov 27-Jun-14 1:48am    
Because "div" is a block element. Wrong idea.
The solution is way too obvious — please see my answer.
—SA

1 solution

First of all, always remove all style-related attributes, move all styling to CSS stylesheets.

There can be many ways to solve your problem, but the elegant solution would be using the CSS ::first-letter pseudo-element:
http://www.w3schools.com/cssref/sel_firstletter.asp[^],
https://developer.mozilla.org/en-US/docs/Web/CSS/::first-letter[^],
http://css-tricks.com/almanac/selectors/f/first-letter[^].

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900