Evanss
Evanss

Reputation: 23593

Respect space in code but ignore   with CSS?

With CSS can I make a browser ignore the   character but respect normal white space?

So this:

Some text   More text

Is displayed like this:

Some text More text

Not:

Some text   More text

UPDATE There is actually more white space in my code. I need the default behavior where extra white space doesn't get rendered on the page so I dont think I can use white-space: pre or pre-wrap

So this shouldn't be excessively indent before the initial word.

           Some text   More text

Upvotes: 3

Views: 8352

Answers (1)

Shauna
Shauna

Reputation: 9596

I don't think there's a pure CSS way of doing that, since   is an actual character that is different from the whitespace created by the spacebar in a text editor (what gets ignored by HTML renderers). However, depending on how those are appearing, you may be able to use a script that searches for and removes that character wherever it sees it.

Upvotes: 3

Related Questions