/    Sign up×
Community /Pin to ProfileBookmark

Make html visible on page

Hi,

I need to have html code displayed on a web page so users can cut and paste it. I have searched online for answers to this question but cannot find a tutorial.

Thanks!
Liz

to post a comment
HTML

9 Comments(s)

Copy linkTweet thisAlerts:
@ryanbutlerMar 11.2007 — Just use the ASCII equivalent for greater than or less than signs:

[CODE]<html&gt[/CODE]
Copy linkTweet thisAlerts:
@cootheadMar 11.2007 — Hi there joyforlife,

have a look at this example...
[color=navy]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
#container {
width:600px;
height:200px;
border:1px solid #000;
font-family:verdana,arial,sans-serif;
font-size:14px;
overflow:auto;
}
</style>

</head>
<body>

<div id="container">

<pre>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">

</style>

<script type="text/javascript">

</script>

</head>
<body>

<div></div>

</body>
</html>

</pre>

</div>

</body>
</html>
[/color]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@Major_PayneMar 14.2007 — Use Felgall's Online HTML to Code Converter:

Code Converter

Saves typing all those tags so it reads properly and browser doesn't try to parse it.

Ron
Copy linkTweet thisAlerts:
@tayiperMar 17.2007 — Yeah, just use the <pre> element ...


tayiper
Copy linkTweet thisAlerts:
@ZnupiMar 17.2007 — Yeah, just use the <pre> element ...[/QUOTE]

No. The <pre> Element makes the browser not ignore white space. It has nothing to do with tags. Change every < to &lt; (lt=[b]l[/b]ower [b]t[/b]han) and every > to &gt; (gt=[b]g[/b]reater [b]t[/b]han). Or, if you use PHP, you can just use htmlspecialchars("<something>"); which will return &lt;something&gt;
Copy linkTweet thisAlerts:
@Major_PayneMar 18.2007 — You'all want to do this the hard way when there is a neat online tool to use. Not everyone will want to type the characters for every " < " & " > ". Tool will also provide proper breaks.

Ron
Copy linkTweet thisAlerts:
@the_treeMar 18.2007 — You'all want to do this the hard way when there is a neat online tool to use. [/QUOTE]When did anyone suggest doing it manually?
Copy linkTweet thisAlerts:
@Major_PayneMar 19.2007 — Just re-read the posts for other suggestions that pretty much suggested manual. No alternative was given, but I at least provided a link so the whole page can be converted for a cut and paste operation.

Ron
Copy linkTweet thisAlerts:
@the_treeMar 19.2007 — All they suggested was doing exactly what Felgall's script aids you in, no-one said anything about how to do it. When I've ever had more than two <>s to represent I've used search and replace, which practically every text editor is equipped with.
×

Success!

Help @joyforlife spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...