PowerApps HtmlText Common CSS Adjustments
Dcoration
Full article and easy read on PowerApps HtmlText Common CSS Adjustments — Hung, Chien-Hsiang 洪健翔 | Blog (chienhsiang-hung.github.io)
Div Full Screen
css div full screen position: absolute;
1
.box {
background:red;
position:absolute;
top:0px;
right:0px;
bottom:0px;
left:0px;
}
Center Horizontally and Vertically
css center horizontally and vertically2
- not so good methods (won’t work on PowerApps)
- Using tables
<table> <tr> <td> Centered content </td> </tr> </table>
table { width: 100%; height: 100%; } td { vertical-align: center; text-align: center; }
- Using FlexBox
<div>Centered content</div>
div { display: flex; align-items: center; justify-content: center; }
- Suggested method which works on Powerapps correctly:
- Using translations
<div>Centered content</div>
div { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
Button Width Fit to The Text
css button width based on char count
as simple as width: fit-content;
If you are developing to a modern browser. https://caniuse.com/#search=fit%20content 3
Troubleshooting CSS
css style not working4
i.e. if you put the style below to button in HtmeText
control, things below the font-family: "JetBrains Mono",monospace;
won’t applied
/* CSS */
.button-30 {
align-items: center;
appearance: none;
background-color: #FCFCFD;
border-radius: 4px;
border-width: 0;
box-shadow: rgba(45, 35, 66, 0.4) 0 2px 4px,rgba(45, 35, 66, 0.3) 0 7px 13px -3px,#D6D6E7 0 -3px 0 inset;
box-sizing: border-box;
color: #36395A;
cursor: pointer;
display: inline-flex;
font-family: "JetBrains Mono",monospace;
height: 48px;
justify-content: center;
line-height: 1;
list-style: none;
overflow: hidden;
padding-left: 16px;
padding-right: 16px;
position: relative;
text-align: left;
text-decoration: none;
transition: box-shadow .15s,transform .15s;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
white-space: nowrap;
will-change: box-shadow,transform;
font-size: 18px;
}
since you need to change "
to '
which you need to use Char(20)
/Char(34)
here instead. change it to font-family: "&Char(20)&"JetBrains Mono"&Char(20)&",monospace;
.
Background Opacity CSS
you can either do it like
<p style='
position: absolute;
text-align: center;
background-color: transparentize(#e3e3e3,0.5);
z-index: 1;
'>
<i>You will be transfered to the external app <b>WFO</b></i>
</p>
<p style='
position: absolute;
text-align: center;
background-color: #e3e3e3;
opacity: 0.5;
'>
<i>You will be transfered to the external app <b>WFO</b></i>
</p>
or use background-color: rgba(0, 0, 0, 0.5);
5
- CSS Make A Div Height Full Screen [THREE SIMPLE WAYS] (softauthor.com) ↩︎
- Centering vertically and horizontally with CSS (alvaromontoro.com) ↩︎
- html - Make button width fit to the text - Stack Overflow ↩︎
- How to Troubleshoot CSS Not Working (wpforms.com) ↩︎
- html - CSS Background Opacity - Stack Overflow ↩︎