Hidden Characters in CSS

Hide first x characters

Like others have said, it's not possible to exactly what you want. But just for fun, if it's always "Data: " that you're trying to hide, you could do this:

h4 {    position: relative;    background-color: white;}
h4:before { content: "Data: "; position: absolute; top: 0; left: 0; background-color: white; color: white;}
<h4>Data: This is some random data</h4>

How to display special characters in HTML

I feel so silly. I checked into everything that you guys said in your answers and none of them were working for my situation. Finally I found out that my browser, Chrome, was set to the wrong settings in the font settings! It was set to "Western (Windows-1252)". I changed that to UTF-8 and it worked. Just go to chrome://settings/fonts in Chrome.

How to select ids which contain special characters?

You can escape special characters with a backslash:

#a\>span\.tex {  color: red;}
<div id="a>span.tex"> Some funky ID </div>

HTML Character - Invisible space

You can use word-spacing for this. However to make a more dynamic property you want to use the em unit. This way the unit is based on the font-size, so actually supports all the font families and font sizes:

ol li
{
word-spacing: -.2em;
}

em is not an absolute unit - it is a unit that is relative to the
currently chosen font size.

source: Why em instead of px?

jsFiddle



Related Topics



Leave a reply



Submit