[CLOSED] How to center align an Ext.Net Label?

  1. #1

    [CLOSED] How to center align an Ext.Net Label?

    Hi, i'm pretty new to Ext.Net and could use some layout help with my Ext.Net label.

    From my understanding, the stylespec property lets me add some css directly to a component like this:
    <ext:Label runat="server" Text="Or" ID="txtOr" StyleSpec="position: absolute; text-align: center"/>
    My label is nested within several other containers, which is why I'm using absolute position.
    There's also a separate CSS style that applies to this label to stretch it out to the full width of the container it is in.
    Yet, this label stubbornly remains left justified within its container. Please advise, thanks.
    Last edited by fabricio.murta; Dec 26, 2017 at 2:56 PM. Reason: no feedback from the user in 7+ days
  2. #2
    Hello @Caleb!

    There are several options, and I think it would be best for you to know at least a couple before you decide how to make your page look best.

    As for one, it would be to surround the label in a container with the Center layout. Here's an example using it:
    - Layout - Center - Basic

    But you can also use a HBoxLayout and pack the entries at center. Here's an overview for it:
    - Layout - HBoxLayout - Basic -- click the button before the last one, called Pack: Center so you can see the items within be centered (in the case, other buttons, but it mostly doesn't matter what component is inside -- unless the component forces its layout for some reason.

    As a general suggestion for you as a new Ext.NET user, I'd suggest you to take your time and browse through the whole Examples Explorer. As boring as it may sound, after you browse it once, you'll eventually get more insights on layouts you can use and when you face some obstacle, you can just remember you seen an example that just fixes it for you, and that would be much better than going from scratch. And as you recurrently refer to the examples explorer, it will become each time easier to know what to look for.

    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello!

    Been a while since we replied here and still no feedback. Do you still need help on this issue?

    We may mark this thread as closed if no feedback is provided in 7+ days from now. This won't prevent you from posting here afterwards so, take your time.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 1
    Last Post: Apr 03, 2013, 6:44 AM
  2. how to align the Icon in GridCommand to center
    By harshad.jadhav in forum 1.x Help
    Replies: 0
    Last Post: Dec 30, 2010, 10:24 AM
  3. [CLOSED] Align Center in Panel
    By macap in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Oct 30, 2009, 9:52 AM
  4. [CLOSED] Hi how to align the label text to center?
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 13, 2009, 11:03 AM
  5. Align GridPanel Center. [BUG]
    By hugo.carvalho in forum 1.x Help
    Replies: 2
    Last Post: Aug 11, 2009, 10:26 AM

Posting Permissions