You can use white-space: pre;
to make elements act like <pre>
, which preserves newlines. Example:
p {
white-space: pre;
}
<p>hello
How are you</p>
Note for IE that this only works in IE8+.
More Related Contents:
- Render a string in HTML and preserve spaces and linebreaks
- How to force a line break in a long word in a DIV?
- Can you target with css?
- Preserve line breaks in textarea
- Vertically center element on HTML page with some content on top (Bootstrap)
- CSS Button styling – Need some help -html css RADIO BUTTON LINK
- Make body have 100% of the browser height
- How to create a circle with links on border side
- How can I scale the content of an iframe?
- How to create uneven rounded sides on a div?
- CSS Cut out circle from a rectangular shape
- Problems with CSS sticky footer
- What is quirks mode?
- CSS background-size: cover replacement for Mobile Safari
- How can I make a CSS glass/blur effect work for an overlay?
- Calculator keypad layout with flexbox
- How to exclude particular class name in CSS selector?
- How to make div element auto-resize maintaining aspect ratio?
- floating elements behavior
- How do I prevent the padding property from changing width or height in CSS?
- Div width 100% minus fixed amount of pixels
- overflow:scroll; in
- How do I style the HTML form validation error messages with CSS?
- How can I target a specific column or row in a CSS grid layout?
- How to create a triangle in CSS3 using border-radius
- Adding style to file upload button in css
- What are the default values for justify-content & align content?
- Media queries not working inside an iframe
- bootstrap 4: center inline form inside a jumbotron
- How do I style radio buttons with images – laughing smiley for good, sad smiley for bad?