How to display HTML tags on page? | Sololearn: Learn to code for FREE!

+3

How to display HTML tags on page?

When I write text on Notepad++ and after run on browser, I see what I've done on text editor. But if I want to show tags, it is nothing will appears. How to show everything like simple text? "Now I want to show you how should be used HTML tags: <html></html> , <body></body> <p>, <br/> etc. You need too use open tag and after closing tag: <title>My first page</title> " It was example. So how to show everything when I running page?

6/28/2020 3:08:49 PM

Sigitas S

29 Answers

New Answer

+24

Use &gt; for > and &lt; for <

+9

I think it may be necessary to change all your "<" to "&lt" and ">" to "&gt" in order for them to be printed as you want. So &ltp&gtThis is a p element.&lt/p&gt appears as <p>This is a p element.</p>

+7

Ore it means I am old, and trying to keep up with the latest technology. I grew up before TV was a household item and my first IT job was using arcnet, which no one remembers. The possibilities today are endless. The Internet has grown into a dangerous place, but the web is more usable than gopher, and youtube is crazy for old guys like me. The world is at your finger tips, literally.

+4

maklaudas no error on that one. πŸ‘ You might reconsider the use of xmp. It should work in most browsers, but at some point it will stop working. It was deprecated in HTML3, and will go away at some point. I am used to using a lot of HTML3 tags, but CSS has made most of them redundant. It would be beneficial for you to spend some time learning CSS and you should be able to do all you want to do and a lot more. πŸ˜‰

+4

Ore I was a member of the HTML writers Guild at HTML b.9. It is a hobby for me. I started in IT with DOS 3. So I have been at it awhile. I watched the birth of the internet, and have built PCs since age 11. I love everything electronic, and the Internet has opened a world of possibilities for kids, and I am excited, but cautiously watching as we forget about the safety and the purpose of this wondeful resource we call the World Wide Web!

+2

maklaudas take a look at this code I did a while back... https://code.sololearn.com/W0f0V76BQC6a I have a section of code in green that I am doing what Russ described. The <pre> tag makes the text uniform in width, so spacing is preserved. I am using <code> tags for compatibility and to style the text green. I use html etities for the special characters. See if that might give you some ideas. πŸ˜‰πŸ‘

+2

@Martin Taylor @Code Crasher . Thanks so much. So I see you use < in front and > to end. Not very easy , but I need to try ;) I don't know why can not mention you in comment? :( It is very long way. But it is works. I did same thing easier with <xmp></xmp> https://code.sololearn.com/WBI3S7seaTGf/#html @Code Crasher, I used your example.

+2

@Code Crasher. On my Android phone works (worked before). Now I'm try on computer mention...nothing :( I made another one, and works for me: https://code.sololearn.com/WlCAv8BAOlrm/#html

+2

You can use <xmp> </xmp> for this. Actually, this tag is already deprecated, but still working.

+2

Use &lt text &gt

+2

Martin Taylor my older brother got me interested in electronics building an Altair. I didn't really get interested in computers until the Commodore Pet, but because of my brother, I always had a variety of hardware in the house. I never learned assembly, but did try for a few months with 6502 assembly, but at that stage of my life I was more interested in the basic games published in magazines. lol Had exposure to older VAX and AIX on my first job, but didn't get any time on them, I was primarily a grunt replacing terminals and cabling. It was a great start and allowed me the opportunity to see some large production environments and got me interested in networks. It has been a great ride. Amazed everyday where technology has taken us?!

+1

Thank God for Backward compatibility, but we (Those that actually try) need to make an effort to stay current? 😳

+1

Code Crasher This is in fact the first time I am hearing(actually seeing) about HTML3. I naturally assumed it started from 4 lol. You must have been coding for long.

+1

I don't know what that meansπŸ˜’ but it seems like a great achievementπŸ‘

+1

Code Crasher About the growth of the internet I can't agree more. My generation are really lucky I think.

+1

+1

Keep the html tags in between<p> </p> tags

0

@Russ I tried to do many things. I know one method <xmp> </xmp> put everything inside these elements, but on page shows not a nice and bit messy. And not how I want to see it. So how Sololearn doing that on our lessons?

0

maklaudas If you are on iPhone mentions do not always work. I have to close the app and reopen it several times to get it to work when it stops working. I haven't figured out if it is a network issue or the app itself. 😞

0

maklaudas I get a "Syntax Error" on the console with your code, but it is probably because SL is looking for a DOC Type or html tag at the beginning? just an FYI. πŸ˜‰ Happy Coding!