CSS makes websites look fantastic and it can do the same for Power Apps. Using a HTML box and inline CSS you can create great looking gradients for both backgrounds and buttons and all render perfectly on handhelds and desktops
All the buttons and backgrounds above have been created on Power Apps and are fully functional. Following the steps below we will generate CSS gradients in a HTML text box and create attractive buttons that you can use in your apps
The CSS used is essentially based on just the two lines below generating gradients and borders, so lets take it step by step
We can all create a red rectangle in Power Apps, a rectangular icon with red fill – right? But you can also do exactly the same with a HTML text box and inline CSS
OK, thats interesting but it doesn’t give us anything new I hear you say! However, we can change the background from ‘solid’ to ‘gradient’ by using the linear-gradient property of CSS. By default the gradient flows from top to bottom
We can create even more complex gradients and add more colors. There’s no limit to the colors you can add, though I recommend a maximum of 4 so it doesn’t look too psychedelic!
OK, this is starting to look interesting. We can take this a stage further and flip the box by introducing the direction parameter. Setting a value of zero degrees immediately turns the box the other way up
So far we’ve used just the base color palette but we aren’t limited to that. Let’s change the color scheme completely and start using Hex colors with a 90 degree direction. Its starting to look more ‘corporate’ and usable in every days Power Apps
And finally we are going to overlay a button with a border and text. The button needs to be ordered at the front above the HTML text to use the OnSelect property of the button and have a transparent fill so the HTML text box underneath containing the CSS is visible. The button should be the same size and have the same border radius as the HTML text box so it overlays exactly
All done! HTML Text boxes have Height, Width, X & Y properties just like any other control so you can make them fully responsive. You now have your new button that you can use just as you would any other, but with the added beauty of CSS!
Can you show the code for buttons at top please
Hi Sanja, yes! I’ll post the HTML/CSS code for each of the 6 buttons in the next few hours
Now posted 🙂