How to fix the offset when using pre-wrap with white-space
Thank you for your continued support.
This article contains advertisements that help fund our operations.
Table Of Contents
⇨ Click here for the table of contents for Laravel articles
When using pre-wrap with white-space, extra space may appear at the beginning and cause an offset issue. Here are some solutions to address this problem.
Conclusion
white-space: pre-wrap;
is a convenient CSS property that allows for line breaks with line breaks in the code. However, it may cause issues by applying to areas where line breaks are not intended, such as when using the Enter key.
To resolve this, avoid adding unnecessary line breaks within the styled tag.
Good example
<div style="white-space:pre-wrap;">{{$post->content}}</div>
Bad example
<div style="white-space:pre-wrap;">
{{$post->content}}
</div>
Summary
That's all for now.
For complaints or comments, please send a direct message on Twitter.