Span is an inline element. It has no width or height.
1
2
3
4
5
6
7
8
9
| <div id='box' style='
background: black;
border-radius: 15px;
top: 4%;
left: 2%;
width: 96%;
height: 94%;
position: absolute;
'><span style='color:white; width:100%; text-align:right;'>test</span></div>
|
Things like this won’t work. You need to change the style of a span
to something like below.
1
2
3
4
5
6
7
8
9
| <div id='box' style='
background: black;
border-radius: 15px;
top: 4%;
left: 2%;
width: 96%;
height: 94%;
position: absolute;
'><span style='color:white; width:100%; **display:inline-block;** text-align:right;'>test</span></div>
|
And it worked!
According to Basheer AL-MOMANI (css — Does height and width not apply to span? — Stack Overflow): You could turn it into a block-level element, then it will accept your dimension directives.
contact me Hung, Chien-Hsiang (chienhsiang-hung.github.io)