html code samples
- Started
- Last post
- 11 Responses
- jsaul
whats the best way to put HTML code samples into a HTML page, so that it reads as code and doesnt render...
Nothing Ive tried seems to work that well, want to just add some code snippets to a page
- ukit0
Escape characters?
- jsaul0
<a href="#" title=""> Like that ?
- ukit0
Yea. I don't think there's an easier way, unfortunately, but if you have a lot of text, there are plenty of text editor tools you can use.
For ex, switching between the regular view and HTML view in Wordpress will do it for you.
- jsaul0
ok, thanks ukit, that does the trick, didn't think of it like that, cheers dude
- ukit0
No problem. In terms of the markup, you can also use the <code> tag to wrap your code just to make it more semantically correct. And the <pre> tag will preserve spaces and line breaks in the existing text.
- jsaul0
nice 1 , thanks guys
- vaxorcist0
save the code in it's own file as file.txt
then use an iframe src="file.txt" in the page showing the codeiframe src="include.txt" width=400 height=400
or whatever.... works on Win/FF and Win/IE 6
- sublocked0
...you can embed the pastes in your pages with JS. color coded too.
- jsaul0
all good ideas.. im gonna defo try out that pastie script, looks pretty neat