trend Posted July 10, 2005 Posted July 10, 2005 How do I center text in a webform's textbox or label ? thanks Lee Quote
Administrators PlausiblyDamp Posted July 10, 2005 Administrators Posted July 10, 2005 Easiest way is to applya style of text-align: center - best done through a stylesheet. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
trend Posted July 11, 2005 Author Posted July 11, 2005 I opened up my project.. and I saw a Styles.css.. I assume that all asp.net/vb.net projects have the styles.css in them as default? And the style sheets are already utilized? Quote
trend Posted July 11, 2005 Author Posted July 11, 2005 Nm.. got it.. very easy.. Just drag 'styles.css" to the aspx project..and then styles.css is enabled :) But.. How do I center the label txt using stylesheets? Quote
bri189a Posted July 11, 2005 Posted July 11, 2005 Google CSS .... for future ref. To answer your question. Give yourself a class in the style sheet for the things you want to have center aligned. Then in that class use the text-align property and set it to center: .centerText { text-align: center; } Again, Google CSS, it will help. Quote
trend Posted July 11, 2005 Author Posted July 11, 2005 Actually.. my problem was something I wasn't explaining right.. the label was 300px wide.. and i wanted the txt inside the label to be centered. So what i did was just set the label to nothing px wide. then centered it. (with css or <center></center>) Quote
trend Posted July 11, 2005 Author Posted July 11, 2005 Also.. I still don't know how to apply .centerText to just this: <P><asp:label id="errormsg" runat="server" Height="32px" ForeColor="Red"></asp:label></P> Ideas? /ps.. using <center></center> results in this errror msg: The World-Wide-Web Consortium now regards the element 'center' as outdated. Newer constructs are recommended. Quote
trend Posted July 11, 2005 Author Posted July 11, 2005 (edited) I can center fields with CSS.. But I need to center the text inside a label field.. I cannot just center the label field (because it has to be justified right) any ideas? thanks Lee Edited July 11, 2005 by trend Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.