This is a migrated thread and some comments may be shown as answers.

Maintaining text centering while adjusting width dynamically

1 Answer 11 Views
Button
This is a migrated thread and some comments may be shown as answers.
C
Top achievements
Rank 1
C asked on 13 Jun 2014, 07:32 AM
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?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 13 Jun 2014, 10:51 AM
Hi,

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.

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

C#:
protected void Page_Load(object sender, EventArgs e)
{
    RadButton1.Width = Panel1.Width;
}

Please provide your code if it doesn't help.
Thanks,
Shinu.
Tags
Button
Asked by
C
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or