Go to a new line after meet some char with css

Roberto C.

I have something like this in a CSV spreadsheet:

<p>Features:• first feature• second feature• third feature• fourth feature• and so on (the totale feature number it's variable)</p>

I would like that each feature go on a new line without insert any HTML tag like this:

Features:
• first feature
• second feature
• third feature
• fourth feature
• and so on (the totale feature number it's variable)

Can CSS be used for achieve this result ?!

(javascript allowed)

Thanks.

Fabrizio Calderan

In my opinion the best solution would involve a server-side script, parsing and changing the structure of your markup. With the given structure, the CSS alone can't be useful to achieve the result.

Anyway, if javascript is an acceptable approach, you could do a simple replace like this after the insertion of the paragraph:

Example http://codepen.io/anon/pen/qoCGI

var par = document.getElementsByTagName('p')[0];
par.innerHTML = par.innerHTML.replace(/•/g, "<br />•");

if you have other characters that you're not able to identify, use a safe range of unicode sequences, like so

par.innerHTML = par.innerHTML.replace(/[\u017C-\uFFFF]+/g, "<br />•");

Result

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

CSS :after element being pushed to new line

From Dev

Some bug with char* and new

From Dev

How to break a line after some certain width in css

From Dev

How to try new permutations if previous solutions did not meet some conditions?

From Dev

How to try new permutations if previous solutions did not meet some conditions?

From Dev

Appending to new line will not go to new line

From Dev

Bat replace new line char to "|"

From Dev

CSS force new line

From Dev

CSS trick for float left without new line but show some and hide remaining

From Dev

Replace a "new line" char with regex in C#

From Dev

fgets() Read New Line Char From Keyboard

From Dev

FPDI New line after ... characters

From Dev

New line after the command prompt

From Dev

New line after <li> bullet

From Dev

Add new line after adding a new control

From Dev

UICollectionViewFlowLayout - Force new line for some items

From Dev

UIActivityViewController not passing new line characters to some activities

From Dev

Tooltip CSS: Remove new line

From Dev

CSS menu breaking into a new line

From Dev

Heap corruption after new char[strlen

From Dev

cannot get span to go to new line

From Dev

why does \n not go to a new line

From Dev

break line after some number of measures in lilypond

From Dev

break line after some number of measures in lilypond

From Dev

Some problems after new project in Eclipse on Windows

From Dev

After printing the previous line where the file contains a single token now need to traverse through the result to meet the requirement

From Dev

'A end of line can't go after this """' in this applescript

From Dev

Regex for new line after last match

From Dev

zsh new line prompt after each command

Related Related

HotTag

Archive