I'm having a issue with Android not displaying multiple spaces for text in a <div>
. If you look at my example below on desktop, the text "Test" is at the very edge on the right. If you look at it on an Android device, it's about 20ish pixels away from the right edge. I'm using the white-space:pre-wrap
CSS style, but for some reason it renders incorrectly on Android.
I'm building a text scrolling app that needs to respect spaces that the end-user enters. Basically, I need to display what the user enters, multiple spaces and all.
Does Android render white spaces differently? If so, how can I get it to look consistent across all platforms?
.parentDiv {
width: 277px;
height: 50px;
top:0;
left:0
position: absolute;
background-color: rgb(0, 0, 0);
word-wrap: break-word;
line-height: 1.0em;
overflow: hidden;
z-index: 1002;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
filter: alpha(opacity=100);
-moz-opacity: 1.00;
-khtml-opacity: 1.00;
opacity: 1.00;
font-family: Arial, fallback Arial;
font-size: 14px;
text-align: start;
color: rgb(191, 190, 191);
border: 0px solid;
-webkit-touch-callout: none;
-webkit-user-select: none;
khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.textBoxText {
font-family: inherit;
font-size: inherit;
text-decoration: inherit;
}
<div id="layer-0-0" class="parentDiv">
<div class="textBoxText"> TEST</div>
</div>