Justification of Labels


Donald Walker

I have a lable that I want centered width wise on my screen even when the size changes. How can I set the label property to center that way? Or right justify for that matter?

Thanks


decsoft

Hello Donald,

One possible way (if you have the very latest release of App Builder published right now) is to use the "TextAlign" CSS property of the Label control. In the object inspector, you can view a "TextAlign" property in the "Normal", "Hover" and "Focus" tab. Just choose one of the available values for this property like "center", "right", etc.

Another possible way to align the Label can be using their "Classes" variable. In that variable we can put the value "text-center" or "text-right". These CSS clases are provided by Bootstrap CSS and has available from us.

Another possible way is to use the app's "Inlince CSS". Access to that from the app's options dialog or from the designer object inspector. In the CSS editor, write something like the below code, suposing your Label name is "Label1", change the identifier for your Label's name.

The above code center the label.

The above code align the label to the right. Other possible values for "text-align" can be found here. This way can be useful, because we can use media queries, for example:

The above code means "If the browser window is smaller than 500px, put the 'Label1' to the right".

Finally, we can also use some actions to change the Label's alignment programatically, for example:

Hope this can help you Donald. If you have any further question don't hesitate to post it.



Donald Walker

Sweet! Really nice.

Thanks David


decsoft

Always thanks you Donald. :)



Donald Walker

I guess this is related, but how do I allign text in a pushbutton. My text is on the bottom edge of the buttton, so I tried the paddingbottom css but it does not do anything. I'm not sure what value it would be looking for anyway. Is it pixals? 10 or 10px or ?

I'm looking for way to get my text centered in all directions in a pushbutton, regardless of what size the button.

Ok maybe this is not an issue as I notice when installed on my phone the text seems centered but not so much in the debugger view.

So....


decsoft

Hello Donald,

This is quite strange. The push button's text appear centered by default... how you get a button with their label not centered? Can you provide me a little sample application?



Donald Walker

As I said, it does appear centered correctly in the installed app. But in the debugger view it is centered horizontal, but not vertical. I will send you an image by email.

Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.