Html/CSS - Best Practice for Preserving White Space on Certain Elements

HTML/CSS - Best practice for preserving white space on certain elements?

I would use the same technique, but inside a data class wrapper where it is needed:

.data a, .data span, .data tr, .data td { white-space: pre; }

HTML:

<div class="data">
....

</div>

How to allow extra spaces in html lists

You can set white-space: pre on your li elements

li { white-space: pre}

See https://developer.mozilla.org/en/docs/Web/CSS/white-space for more info on white-space.

Render tree in html preserving white space

You need a monospace font, so no matter the character, the size it takes is the same for each characters

<span style="white-space: pre-wrap;font-family:monospace;">
└─--[TaskD-{'a': '0.28', 'b': '0.296', 'c': '0.364', 'e': '0.486'}]
|---[TaskC-{'a': '0.28', 'b': '0.296', 'c': '0.364'}]
| └─--[TaskB-{'a': '0.28', 'b': '0.296'}]
| └─--[TaskA-{'a': '0.28'}]
└─--[TaskE-{'c': '0.364', 'e': '0.486'}]
|---[TaskF-{'c': '0.364'}]
└─--[TaskG-{'c': '0.364'}]
</span>

Preserve whitespace between concurent HTML elements in raw markup

As cale_b recommended, I will be using following CSS hack to add a space before element that lacks my spacing:

.monograph {
* + span:before {
content: ' ';
}
}

Render a string in HTML and preserve spaces and linebreaks

Just style the content with white-space: pre-wrap;.

div {    white-space: pre-wrap;}
<div>This is some text   with some extra spacing    and afew newlines along with some trailing spaces             and five leading spaces thrown infor                                              goodmeasure                                              </div>

Replace continuous space with single space and multiple   elements

Try this,

string str = "<B>This is          Whitespace      Node </B>";
Regex rgx = new Regex("([\\S][ ])");
string result = rgx.Replace(str, "$1.")
.Replace(" .","?")
.Replace(" "," ")
.Replace("?"," ");

Lot of unwanted space above html table in IE browser

There were lot of   added in printOtherDocuments() method which I dint notice earlier. After removing those the issue was fixed.



Related Topics



Leave a reply



Submit