Embarrassingly simple issue

What I’m trying to do:
center a label on the screen

What I’ve tried and what’s not working:
google, this forum, following these instructions which dont appear valid anymore;

  1. Select the label component in the Anvil editor.
  2. In the Properties panel on the right, find the align property.
  3. Set the align property to "center" for both the horizontal and vertical alignment options.
    Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 

Clone link:
share a copy of your app

sorry for such a ridiculously simple topic, but tiny things like this can scare me off when by all accounts there should be a simply way to align labels without going into the css. Brand new to Anvil, tried googling, asked chat gpt, searched this forum and I swear I spent 10 minutes going up and down the properties page knowing I was missing it but I simply cannot find any way within the anvil UI to adjust the alignment of this text.

Any help appreciated.

What should I do in the future for questions like this? I simply cannot figure out what to do

You can set the text align to “center”

image

image

alternatively, in the code you can set the align to “center” as well and this will center the label once it is “Ran” or in production and the script has been read. It won’t center it in the IDE unless you use the proprieties box above.

2 Likes

Thank you internet stranger - you are my hero today.

The “Code Snippets” button in conjunction with my crappy tiny monitor made finding the “more” for this field very hard to find. That, on top of me being a general overall doofus.

Thanks again!

3 Likes

@fungifaucet Also Welcome to the forum :wave:

If you have any more questions about the Properties panel in the IDE, here are the relevant docs for it:

If you are interested in changing any of these settings with code and or programmatically, check out the left panel of this link, under anvil you will find all the components:

Where it will give you information about each object and what its built in properties and methods are.

Example:

2 Likes