From the course: Crafting Meaningful HTML

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Displaying code with <code>, <samp>, and <kbd>

Displaying code with <code>, <samp>, and <kbd> - HTML Tutorial

From the course: Crafting Meaningful HTML

Start my 1-month free trial

Displaying code with <code>, <samp>, and <kbd>

- [Instructor] Unsurprisingly, HTML offers several tags for marking up code, keyboard inputs, and screen outputs. It's easy to confuse which tag is used for what. So if you're a coding person, here's what you need to know about marking up code with HTML. This is my starting code pen for this particular example. And as you see here, there are some instructions to do some work, and then there's some code inside of this pre tag, so here's what you're going to do. You're going to write an alert dialog box using JavaScript. You're going to use command option I to open up your browser's coding console. And then you're going to type in some code here, some JavaScript into that. Hit return, and then you're going to see a pop-up box that's going to show up after that. That's what our text is. And right now, this is just marked up with a series of paragraphs, except for our little bit of code right here, which uses the pre-tag, this is the pre formatted tag. And that tag indicates that…

Contents