Description
This rule will teach you what are the perfect way to write an attribute in html?
There are some rules which can guide you. It helps you a lot when you write your code in html. It based on attribut, so It is reasonable to focus on how to write perfect attribute in html. Attribute value pairs that what this page focus on.
Some rules
Rules in general:
- Attribute must have a value, we call it as name value (eg : type="email")
- Attribute values must have quotes
- Attribute are separated with space.
- Attribute names need to be lower case
- Elements types have private attribute.
-
Public attributes can go on any element
- Class
- id (identification card)
- No double quotes inside of double quotes.
- Use only - to separate contribute name
This is an examples
Do not do this!
<nav>
<ul>
<li>
<img src="BELLOW CASE.JPG">
</li>
<li>
<img src="CANDLE.jpg">
</li>
</ul>
</nav>
Instead do this
<nav>
<ul>
<li>
<img src="bellow-case.jpg">
</li>
<li>
<img src="candle.jpg">
</li>
</ul>
</nav>
Do not do this!
<nav>
<ul>
<li>
<a href="index.html"picture"">Picture</a>
</li>
<li>
<a href=" ">..</a>
</li>
</ul>
</nav>
Instead do this
<nav>
<ul>
<li>
<a href="index.html">Index</a>
</li>
<li>
<a href="page.html">Page</a>
</li>
</ul>
</nav>