What I’m trying to do:
I am trying to decrease the padding of my TextBox, to fit in more text with my limited space, with a custom role. I am not that experience with css so I am kind of just taking shots in the dark. But saying this I do have a hunch that my solution lies in the styles.css file (that I either don’t have access to or cant find)!
Trying to get 4 numbers in a TextBox this size.
What I’ve tried and what’s not working:
I have made my own custom role named ‘input-small’ and added some code (seen below) to the theme.css file.
Edited Code Scr:
The following screen shot is what I have tried to edit to achieve my goal. Specifically, I have tried editting the border-radius: and the border: (from example code).
If what you want to modify is the padding of your component, then border and border-radius are not the right properties, padding is! Try playing around with that property instead, and see if it does what you are looking for.
I’d also recommend taking a look at our Styling Apps with CSS tutorial. Apart from outlining some CSS basics and linking to some resources, it runs you through how to access DevTools, which might be quite helpful to play around with things in real time before changing them in the theme.css.
I don’t know the answer to your question @CoenD. I’m going to pile on instead.
Often times in this situation, for each component I navigate to the Layout screen in the Properties tab and set the spacing_above and spacing_below to none. This is pretty painful to do component-by-component (though @CoenD if you haven’t done this it’s a place to start).
This helps but typically I still find a lot of extra white space I’d like to get rid of.
@patricia, can you please provide a bit of an explanation as to how the spacing_above and spacing_below work? Can these be overridden with a custom role, or are these properties somehow applied AFTER a role is evaluated for a component?
The spacing_above and spacing_below properties affect the margin of a component, rather than the padding. They are set on theme.css, and that looks something like this:
I think targeting the .anvil-text-box class should do it, but I still recommend inspecting the page in DevTools as described in the tutorial I linked above, to make sure that’s actually what you want to change.