Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to outline text in HTML / CSS
    primarykey
    data
    text
    <p>Let's say I have white characters and I want a black outline over each character (this is different from outlining the whole text box). </p> <p>What is the code to make this outline ? </p> <p>EDIT: Well bummer, I'm not asking for a whole document. All I want is the one line of code and the needed parameters to create an outline for text. I don't feel the need to post code as it is really just a simply request. </p> <p>I have tried using <code>text-outline: 2px 2px #ff0000;</code> but this is not supported across any major browsers.</p> <p>Scope :</p> <pre><code>function createTitleLegend() { legendTitle = document.createElement('div'); legendTitle.id = 'legendT'; contentTitle = []; contentTitle.push('&lt;h3&gt;&lt;font size="16"&gt;TM&lt;/font&gt;&lt;/h3&gt;'); contentTitle.push('&lt;p class="test"&gt;&lt;br&gt;&lt;font size="6" color=#000000&gt;We have &lt;b&gt;&lt;font size="7" color="white" text-outline: 2px 2px #FF0000;&gt;21421&lt;/font&gt;&lt;/b&gt;&lt;/font&gt;&lt;/p&gt;'); legendTitle.innerHTML = contentTitle.join(''); legendTitle.index = 1; } </code></pre> <p>I have tried using outline within the font, as well as a class and div. None works. The bruteforce approach doesn't seem to work either.</p> <p>Yet another EDIT:</p> <p>This is the key line where I want the outline. </p> <pre><code>contentTitle.push('&lt;p class="test"&gt;&lt;br&gt;&lt;font size="6" color=#000000&gt;We have &lt;b&gt;&lt;font size="7" color="white"&gt;21421&lt;/font&gt;&lt;/b&gt; asdasd&lt;/font&gt;&lt;/p&gt;'); </code></pre> <p>Before I apply the outline, the string is written in one line. After I apply the outline, we have 3 different lines of text.</p> <p>contentTitle is a legend in a Google Maps where the text align is at the center. That sentence that is being pushed uses two different type of fonts, one for the words and one for the number. In the event that I apply a text shadow with a div, that creates a new line. I know the normal solution for keeping everything in the same line is the use of float. However if I float, nothing is centered anymore.</p> <p>Maybe I'm not floating correctly, but I've tried both div style=float and class="float" thus far.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload