
HTML Tutorial — Useful Things: br, hr, input type, em, strong, img alt (9/11)
HTML Tutorial — Useful Things: br, hr, input type, em, strong, img alt (9/11)
www.colorcode.io/course/html-basics/useful-things
Here are a few useful things to remember when writing HTML.
BR Is a break. A line break. If you wanna put a break within your text, if you just press ENTER and go to the next line in your code, it doesn’t mean the browser will render it. It actually ignores it, we call this whitespace. Just like it ignores the spaces or tabs in the beginning of the line, it will ignore your ENTER. By the way spaces and tabs, that’s what Richard in Silicon Valley was talking about in this episode, and one of the reasons he didn’t get laid. Anyway, back to line break: if you have to go to the next line you COULD use a BR. We just talked about Semantics and BR is not good practice. You’re better off using multiple P tags but say you had an ADDRESS tag, you could use BR to go to the next line. It IS available.
If you wanna emphasize on a part of your text, you can use EM tag. It italicizes the text in between. I does the same thing but use EM because it describes the intention, or meaning or semantic behind your code as opposed to how it should look. You can always change the look later with CSS. Same thing for STRONG tag if you want bold text. You can use B but STRONG is preferred. Meaning is more important than look when it comes to picking your tags.
HR will give you a horizontal line. You can achieve this using CSS borders and have more options there but HR does exist if you need it.
ALT attribute for image tags will add a text underneath the image in case the image can’t be loaded. For whatever reason. Slow internet, the image doesn’t exist, whatever. This way the user will at least see what your intention was with that image.
INPUT tags have a lot of different kinds, you can specify what kind it is using a TYPE attribute. The type can be Button, Checkbox, Color, Date, email etc... You know how sometimes when you’re typing your email the keyboard on your phone automatically shows you the @ sign? That’s becomes the guy or girl who made that site changes the input field type to be email. Thank you guy or girl. Password will be hidden like this. And so many other types. So use the right type so that the browser will help create a better experience for the user, and you don’t have to do anything else, just change the type.
Anyway, those were a few useful things you can use in HTML. Bye Bye!
コメント