#HTML
basic grammar
The most basic grammar is:
<tagname>Contents</tagname>
- All of the above are called elements.
- <tagname> is the start tag, </tagname> is the end tag, and the two together are called a tag.
- Contents is content.
for example
<p>Lorem</p>
is called a p element, the start tag is <p>, the end tag is </p>, and the content is Lorem.
attributes
Tags can have attributes.
<tagname attribute="value">Contents</tagname>
For example, if you want to add an id attribute to your blockquote and set the value to abc:
<blockquote id="abc">
...
</blockquote>
Attribute values can be enclosed in double quotes, single quotes, or no quotes. However, if the attribute value contains spaces, it must be enclosed in double or single quotes. for example
<p style="color:red;">Lorem</p>
<p style="color: red;">Lorem</p>
<p style='color:red;'>Lorem</p>
<p style='color: red;'>Lorem</p>
<p style=color:red;>Lorem</p>
will make the letters of the p element red, but
<p style=color: red;>Lorem</p>
does not turn red. Because it interprets the value of the style attribute as color: .
TIP.
Lorem is output just that the text color is not red, and there is no error message. HTML is a loose language that shows as much as possible even if the grammar is wrong.
Comment
Comments are code that web browsers do not interpret. The part enclosed by <!-- and --> becomes a comment.
<!-- Comment -->
Even if there is a line break, it will be treated as a comment.
<!--
Comment
...
Comment
-->
Putting comments within comments can have undesirable consequences. For example, in the following case, abc --> on the last line will not be treated as a comment and will be output to the web browser.
<!--
<!--
Comment
-->
abc -->
TIP.
Note that annotations are not interpreted by web browsers, but can be seen by anyone in source view.
'HTML' 카테고리의 다른 글
[HTML] HTML/ol, ul, dl/sorted list, unsorted list, definition list (0) | 2022.08.04 |
---|---|
[HTML] HTML/br/line break tag (0) | 2022.08.04 |
[HTML] HTML/h1, h2, h3, h4, h5, h6, p/ title and paragraph (0) | 2022.08.04 |
[html] Table (Table) Total organization (total organization, merge, alignment, screen color) (0) | 2022.07.22 |
What is HTML? (0) | 2022.07.22 |