Let me clarify if the title seems unclear.
I am developing a Q&A application using NodeJS, MongoDB, and Express.
Currently, I am working on the layout using CSS.
There is a small textarea where users can submit text. Upon clicking the submit button, they are redirected to a page displaying the entered data from the form.
However, the text in the main body exceeds the max-width I set for the div. This issue arose after adding the "white-space: pre;" property to allow line breaks in the post. Prior to that, the text stayed within the 960px width defined for the div but lacked line breaks.
Jade code snippet for this view:
extends layout
block content
div.pageContainer
h1 #{discussion.title}
span(id="categoryMarker" style="font-size: 1.25em;") "#{discussion.category}"
h3 #{discussion.author}
| -
span Created on #{discussion.date.toDateString()}
br
br
div#bodyText
p #{discussion.body}
footer
div.wrapper
a.hvr-grow(href="/discussions") Back to all threads
span.hvr-grow(style="color:white;") –
a.hvr-grow(href="/discussions/create") Start a thread
CSS stylesheet (Related to the paragraph where the input from the textarea is displayed)
#bodyText
{
font-size: 0.75em;
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
max-width: 960px;
}
#bodyText p
{
white-space: pre;
}
The overflowing text appears like this:
This should not happen. Any suggestions or tips would be greatly appreciated.