Maintaining text centering while adjusting width dynamically

2 posts, 0 answers
  1. C
    C avatar
    43 posts
    Member since:
    Jul 2013

    Posted 13 Jun 2014 Link to this post

    I want my RadButton to fill the width of a container (a container whose width depends on the screen resolution). But if I do this via css (width: 100%!important; in the css-class added to the button), the button stretches out to the right, but the text does not move right. Causing the button text to look aligned to the left, rather than to the center.

    How do I fix this?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Jun 2014 in reply to C Link to this post


    Unfortunately I couldn't replicate the issue at my end. Please have a look into the sample code snippet which works fine at my end.

    <asp:Panel ID="Panel1" runat="server" Width="300px" style="border : 1px solid red;">
        <telerik:RadButton ID="RadButton1" runat="server" Text="demo">

    protected void Page_Load(object sender, EventArgs e)
        RadButton1.Width = Panel1.Width;

    Please provide your code if it doesn't help.
Back to Top