From the course: HTML Essential Training

Unlock the full course today

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

Code, pre, and br

Code, pre, and br - HTML Tutorial

From the course: HTML Essential Training

Start my 1-month free trial

Code, pre, and br

- Sometimes you want to put some code on a webpage. Let's say you're writing an article about making a webpage or you want to tell people about some of the syntax encode. Here, we've got some CSS in the middle of a sentence. I'd like that code to stand out and look like code. So I'll use the code element. I'll type an opening code tag before my bit of CSS and a closing code tag afterwards. You can see that the styling changes. It switches to a monospaced font and of curse we can make this look however it is that we want it to look. Code, by default, is an inline element. So this part of the CSS remains part of the sentence that it's in, inline. Now what if we wanted to write about some HTML as well? I want to change this word H4 by putting the brackets around it but oh, it turned the word element into an H4 headline. It did the thing rather than printing H4 out on the page. Let me try wrapping this in a code element but…

Contents