css - White-space:pre-wrap causes extra spacing -


i'm working on making portions of website more mobile friendly. rather re-work original pages decided we'd duplicate pages needing mobile versions , redirect accordingly.

i have following mark-up looks fine on desktop version of page.

<div class="description">     <asp:literal id="lbldescription" runat="server"></asp:literal> </div>  .description { white-space: pre-wrap; } 

but on mobile version i'm getting series of white spaces added beginning , end of content. ends being rendered so.

                              lorem ipsum dolor sit amet, consectetur adipiscing elit. vestibulum ornare posuere efficitur. suspendisse molestie, leo in vestibulum condimentum, ligula risus rutrum mi, condimentum augue quam nec velit. nullam quis elementum ipsum, vitae facilisis tellus. integer sed turpis eget purus pellentesque suscipit eu non magna.                                               

viewing content in firebug looks this. notice single white space @ beginning , end of content.

<div class="description"> lorem ipsum dolor sit amet </div> 

and when edit content in firebug becomes this

"                             lorem ipsum dolor sit amet                         " 

these white spaces not on desktop version of page, mobile version. html markup , css same on both versions of page. removed of other markup on page , still happens. if change white-space value other pre-* looks fine. difference between these 2 pages addition of bootstrap , removing doesn't make difference.

does have ideas? need white-space:pre-wrap preserve carriage returns.

try

<div class="description"><asp:literal id="lbldescription" runat="server"></asp:literal></div> 

in html whitespace character (newline/tab/space) inside tag's content considered when rendering.

see this question more discussion.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -