Software, your way.
How To Get Good Custom Software
(Download)
(PDF)
burger menu icon
WillMaster

WillMaster > LibraryWebsite Development and Maintenance

FREE! Coding tips, tricks, and treasures.

Possibilities weekly ezine

Get the weekly email website developers read:

 

Your email address

name@example.com
YES! Send Possibilities every week!

Borders for Text Characters

Because text characters are vector graphics, individual characters can have borders.

It is done with CSS. No JavaScript required.

The border, correctly called "stroke", can be customized. The stroke's color can be specified. And the stroke width can be specified.

The fill color can also be specified.

Here is an example.

HELLO

The fill color is aqua. The stroke is blue and 2 pixels wide.

Here is another example. Its fill color is yellow. The stroke width is 4 pixels. And the stroke color is orange‑ish.

HELLO

The fill color for the third and last example is specified as transparent so the background shows through.

For the example, the text was put into a div with a gradient-color background. It works just as well with a solid color or with a background image.

The stroke width for the characters is 2 pixels and the stroke color is red.

HELLO

Compatibility

It works with the latest versions of Safari, Firefox, Chrome, and Opera. I was unable to test this with Edge.

If someone's browser doesn't recognize the CSS, the text will be the default color. In other words, it degrades gracefully.

A Tool to Generate the CSS for Character Color and Stroke

A tool was created to design color and stroke for text characters and generate the CSS to implement the design.

Use the tool to specify your preferences. It will show you the result and give you the code for the CSS definitions.

Type your specifications in the form. The box above the form is a preview. The box below the form contains the CSS style.

Text Character Color and Stroke Tool

Tap anywhere outside the last-changed form field to update the Preview and the CSS. Note: Invalid values in form fields will not update the Preview.

The Preview

Fly

The Form

Example text:

Font size (pixels):
Font style:
Font weight:
Font family:
Fill color:
Stroke color:
Stroke width (pixels):

The CSS

Being able to border text characters with fill and stroke colors and sizes, including transparent fill, provides a lot of design possibilities. Besides, it is just plain fun.

(This article first appeared with an issue of the Possibilities newsletter.)

Will Bontrager

Was this article helpful to you?
(anonymous form)

Support This Website

Some of our support is from people like you who see the value of all that's offered for FREE at this website.

"Yes, let me contribute."

Amount (USD):

Tap to Choose
Contribution
Method

All information in WillMaster Library articles is presented AS-IS.

We only suggest and recommend what we believe is of value. As remuneration for the time and research involved to provide quality links, we generally use affiliate links when we can. Whenever we link to something not our own, you should assume they are affiliate links or that we benefit in some way.

How Can We Help You? balloons
How Can We Help You?
bullet Custom Programming
bullet Ready-Made Software
bullet Technical Support
bullet Possibilities Newsletter
bullet Website "How-To" Info
bullet Useful Information List

© 1998-2001 William and Mari Bontrager
© 2001-2011 Bontrager Connection, LLC
© 2011-2024 Will Bontrager Software LLC