Possible to apply border to just the top of a component?

Hi - I basically want a line at the top of a repeating panel, without a border around the whole thing.

I’ve wrapped other repeating panels in a border, but the border is the same on all sides of the panel, not what I’m looking for here.

Is there an ‘upper-border’ or ‘top-border’ I can apply with just using the Anvil syntax and without using a separate .css file?

2 Likes

I don’t think so, but if you file a feature request I’ll “like” it to vote for it. I think we need more control over things like that from the IDE.

Currently, if you create a role (Theme -> assets -> configure roles), add the css to themes.css for class “.anvil-role-xxxx” where xxxx is the name you gave the role, then you can apply that role to any control in the IDE by selecting that role under “appearance” and it should show up in the designer.

2 Likes

I like this, I was wondering about what the ‘roles’ and what they do…

I created a role:
image

Got some code from W3CShools

image

Applied it to theme.css

image

Set the Role in the appearance section
image

And nothing happens!

1 Like

Ah, right.
What you’ve done is created a class called :

anvil-role-anvil-border-upper

I recommend renaming (or recreating) the role as just “border-upper”.
Rename your theme.css class as

anvil-role-border-upper

That should work.

The “anvil-role-” is added automatically by Anvil to the role name, so you just need to create a class of “anvil-role-xxx” where xxx is the name of the role you created.

1 Like

Got it to work, that’s a cool trick!

2 Likes