Difference between tag and element?
- HTML Tags are the starting and ending parts of an HTML element. They begin with < symbol and end with > symbol. Whatever is written inside < and > are called tags.
- Example: In this example is the starting tag and is the ending tag
<b> </b> The HTML element consists of both the opening and closing tags as well as what’s inside those tags. It normally consists of some structure that’s used to define the respective tags.
Example: In this example is the starting tag and is the ending tag but with content inside it.
<b>This is the content.</b>
Semantic Tags
Html5 semantic tags provide meaningful tags that clearly describe their purpose, improving readability ,accessibility ans SEO for both humans and browsers.
Attributes
The HTML element consists of both the opening and closing tags as well as what’s inside those tags. It normally consists of some structure that’s used to define the respective tags.
Example: In this example is the starting tag and is the ending tag but with content inside it.
<b>This is the content.</b>
Ex: header,nav,section,article,main,footer
Difference between px,%,vh/vw?
Pixel
- Fixed length
- best for borders and icons.
Percentage(%)
- Relative to parent element
- Good for Responsive layouts
vh/vw
- relative to viewport's height
- Good for Full screen backgrounds
Self Closing tags
- Self-closing tags are HTML elements that do not require a separate closing tag because they cannot contain child elements.
- They are also called void elements in HTML.
- Ex:
<img>,<br>,<input>,<link>,<hr>