Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
353 views
in Technique[技术] by (71.8m points)

html - My browser will not display special characters

I have linked my HTML code here. Why is it that when I open this file (locally) on my computer, some special characters will not show. For example, imagine I wrote this code:

nwqidn wqindiwq dwqin <wiqndiw

When opened, the browser will not display the last line of gibberish (anything after and including the less-than symbol). I understand that the browser might have some confusion about when to end the tag, but surely the google browser is advanced enough to know the difference between the closing p tag and a random "<" symbol. I know that I can use the Unicode for "<" and it will display, but I'm trying to find a different solution. Is there any special something that I can put (maybe as metadata?) in my HTML file in order to solve this issue? Thanks in advance for any help.

Here's my entire code of the page below:

<!DOCTYPE html>
<html>

<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8">

<title>Test</title>
</head>


<body>
<p> dniqwn qwnid wqudn <inwqd </p>

</body>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can use &lt; for 'less than' and &gt; for 'greater than' to insert < and > into html.

Otherwise, as you say, the browser will think you're opening a tag.

<!DOCTYPE html>
<html>

<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" charset="utf-8">

<title>Test</title>
</head>


<body>
<p> dniqwn qwnid wqudn &lt;inwqd </p>

</body>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...