HTML displaying special characters

I’m re-designing several pages on my website. I’m removing the line graphics, and replacing these with the special character — which is formed by ALT + 0151

I know it would be MUCH easier just to use the underscore _ but the special character ALT + 0151 lines up neatly and forms a continuous line with no “dashes” (when viewed in an HTML document browser).
The underscore would produce results such as this:


WEBPAGE TITLE


OR:


WEBPAGE TITLE


Sure the second example has better symmetry but there’s a lot of space between the lines and the title.

Any ideas what’s going wrong when I try using the ALT + 0151 to do this?

————————————————————————
WEBPAGE TITLE
————————————————————————

:smack: Sheesh I guess I should have said what the problem is.

Sometimes that ALT + 0151 character will display a question mark or even something like this 覧

Weird huh?

Is there any particular reason you’re not using <hr>? You can use CSS styles and/or HTML attributes to change the width and color of the rule much more flexibly than with character art, as long as you just want a horizontal line.

Try this:


<hr>
<h1 style={margin-top:-5pt}>Stuff</h1>
<hr style={margin-top:-17.5pt}>

Omphaloskeptic

Well, I figured the simplest way to draw a vertically-centered horizontal line would be to use the special character for that ————————————————————
I have used it in the past and it worked. Seems, it just isn’t working properly lately.

Wouldn’t it seem that the simplest way would be the least error-prone? After all, it doesn’t require any new HTML commands, tables, frames, JavaScript routines, etc. All I’m “asking” the HTML to do is to display those characters just as easily as if I wanted to display a string of letters.

awldone
I found this code:
<h1 style={margin-top:-5pt}>________________________</h1>
was quite successful.

Thanks to both of you for your help.

HTML is a markup language. The whole point of HTML is that it contains extra commands, adding extra complexity beyond plain text, to allow more readable and more structured documents. <HR> is one of these commands, and it seems reasonable to use that where you want a horizontal rule since that’s what it does. A string of dash characters cannot be interpreted as easily as a structural element; it is only used in ASCII since there’s nothing better. <HR> is not “new”–it’s been in HTML since the beginning, as far as I know. It also has nothing to do with tables, frames, or JavaScript, though if you use the STYLE attribute, as in awldune’s examples, then it does use CSS.

More generally, I think that if something that was working in the past no longer works, it is a hint that you’re doing something the wrong way, using it in a way it was not intended to be used. Maybe at a higher (or lower) monitor resolution, or a different fontsize, the characters that seemed to run together smoothly will show gaps because of finite pixel sizes. Maybe this machine’s character set has a different spacing than the one you used. It’s difficult to predict how your line of dashes will look on different machines, but an <HR> should look pretty much the same everywhere.

Not if what you think is the “simplest” way is actually the “highly platform-specific” way. The way you are doing it is actually much more error prone. You are never supposed to use ALT-xxxx characters in your HTML. What shows up as a special underscore on some computers may show up as a Euro symbol on others. This is the entire point of “entities” which allow you to say “I’d like a euro symbol here, so rather than typing ALT-xxxx, I will write ‘€’ and the browser will put the correct symbol there no matter what platform it’s running on.”

So you really have two issues:

  1. using ALT-xxxx characters in web pages is broken
  2. as Omphaloskeptic points out, using characters to draw things like section breaks is contrary to the purposes of HTML. Use an <hr>; that’s what it’s for. Doing otherwise is kind of like asking, “does anyone know how to get my ‘v’ characters to run together? I like putting two side-by-side instead of writing ‘w’, but it looks funny because there’s a space between them.”