Remember Me
forgot your password?

Three Ways to Display Sample Html in a Web Browser

If you’re looking to write about web design and HTML, you’ve no doubt run into this problem. How do you display sample mark-up that the user can see?

The problem is simple. You want to display the sample markup. The user’s browser wants to render it as actual mark up. You need to come up with something to tell the browser - “Hey, this isn’t supposed to be rendered!”

There are a few ways to do this.

First, you could use an xmp tag.

The xmp tag was developed for displaying "example" HTML. Once the browser sees an xmp tag, it stops rendering all HTML until it sees a closing tag.

However, the tag is deprecated. It's no longer included in the HTML standards - which will prevent your site from validating - and it may not be supported by all browsers. Use at your own risk.

A second, more reliable method, is to include the markup in a textarea box.

When you create a textarea element, you can include text in between the opening and closing tags as "default" text. Any HTML in this text remains unrendered - which allows you to easily display your sample markup.

There are two problems with this, though. First, you can't include a closing textarea tag within your example - or it will prematurely close the textarea that you are using to display your example. You also cannot style the text at all with css.

The third solution - probably the best - is to escape all of the signs in the sample code.

If you replace < with <, the browser won't think that the tag is real html. It will simply display the markup.

This is by far the surest method of displaying your sample HTML, the only problem is that you need to escape all of the characters. However, you can take a shorcut - use this form to do the escaping for you.

Copy and paste your own code in, and the escaped code will be created on the spot.

Brian Rock

I'm the author of Web Cash - a blog about web design, writing, and making cash on the net. You can read more about How to Display Sample HTML, or check out the latest HTML Tutorials.

Rate this Article: 0 / 5 stars - 0 vote(s)
Print Email Re-Publish

Add new Comment



Captcha

  • Latest Web Design Articles
  • More from Brian Rock

Flash Website Designing - Usage in e-Business

By: Amya Adora | 12/11/2009
Flash Website Designing helps the web today, Which is a gamut of websites that are designed in varied creative techniques which make them appear attractive and definitely more interactive. Businesses that wish to acquire a stronger presence in the internet, are readily adopting flash website designing

Quick Reference Links To Fight Iframe Injections

By: Joseph Schembri | 11/11/2009
I have had many requests from people reading my articles on combatting iframe injection to create a quick start guide with the various links one can use to detect and recover from iframe injection attacks.

Free Website Design is offered by iQuest an Atlanta Web Design firm

By: ShaiQuest | 11/11/2009
Atlanta Web Design Company iQuest Web Design owes its success to its community and, as a token of appreciation, iQuest Web Design would like to offer a free web design to churches, schools, and non-profit organizations.

5 Items to Look for When You Buy a Golf Travel Bag

By: Anna Jones | 11/11/2009
A well-known club-and-ball game, in which the skilled golfers use different types of clubs and try to hit the balls in every hole on a large golf course, is known as golf. It is one of the most famous sports in the world. People love watching a game of golf. There are a number of equipments that are required to play golf. The best thing to gift a professional golfer is a golf travel bag.

All About Freelance Web Designer

By: Anna Jones | 11/11/2009
Web design is merely the skill of creating presentations of matter frequently, hypertext that is delivered to the end-user through the means of World Wide Web. It is essentially a sort of graphic designing. Nowadays, many people are going for freelance web design. It is very helpful for some people. A freelancer is mostly a self-employed person who is not committed to a specific company.

Geo Targeted Website Design

By: Hemanta | 11/11/2009
Target the global audience using Geo Targeted websites & experience the unique features!! Geo Targeted Website targets an audience belonging to a specific region or geographical area.

Web Design Company: Tips on Selecting a Web Design Company

By: Kiran Sonavane | 11/11/2009
Taking due consideration before choosing a web design company for your website is very important; first impression leaves a lasting effect on your website visitors, either for good or for bad. It is therefore very important, that you choose a web designer that will give your website the desired look and quality, which is capable of appealing to the senses of your website visitors.

Website development & design objectives

By: Nice One | 11/11/2009
Nice One offers a full range of strategic web design solutions for businesses, as well as individuals. Our team of professionals with proven experience in the field of web development can provide high quality, cost-effective complete web solutions including complex database integrated websites, e-commerce portals, intranet development and maintenance.

Syndicate RSS Feeds on your Website for Extra Content

By: Brian Rock | 09/02/2008 | Web Design
RSS feeds are a great way for you to keep up to date on your favorite websites. But they can be an even greater tool for a webmaster. You can syndicate RSS feeds on your own site, adding continuously updating content without any work of your own.

How to Encrypt and Hash Passwords in Php

By: Brian Rock | 02/02/2008 | Web Design
If you want to build a user-management system - or work on someone else's - you should know a few basics about how passwords are encrypted or hashed. In other words, how are they made safe for storage?

Submit Your Articles Free: Signup
Article Categories




Use of this web site constitutes acceptance of the Terms Of Use and Privacy Policy | User published content is licensed under a Creative Commons License.
Copyright © 2005-2008 Free Articles by ArticlesBase.com, All rights reserved. (0.04, 1, w1)