Html5 tutorial #3 Styles,formatting,Id,class & Comments
Html Styles
Html styles can be done within the element, head or a CSS file. There are many different style attributes so I will show a few of the most popular examples.
• background-color for background color
• color for text colors
• font-family for text fonts
• font-size for text sizes
• text-align for text alignment
HTML Formatting
Html styles can be done within the element, head or a CSS file. There are many different formatting options so I will show a few of the most popular examples.
• <b.> - Bold text
• <strong.> - Important text
• <i.> - Italic text
• <em.> - Emphasized text
• <mark.> - Marked text
• <small.> - Small text
• <del.> - Deleted text
• <ins.> - Inserted text
• <sub.> - Subscript text
• <sup.> - Superscript text
The .'s are added because of the HTML support in steemit and it otherwise wouldn't properly be displayed.
How styles and formats are applied
<.tagname style="property:value;"> <.!--If you are using the style/format within the element-->
<.p style="color: brown; "> <.!--Example-->
<.head> <.!--If you are using the style/format within the head-->
<.style>
Tagname{
property: value;
}
<./style>
<./head>
<.head> <.!--Example-->
<.style>
Tagname{
Background-color: blue;
}
<./style>
<./head>
Tagname { <.!--If you are using the style/format within the head-->
property: value;
}
Using the class attribute
The class attribute specifies multiple class names for an HTML element. The class name is used by CSS and JavaScript. How to use the class? You either make a class in the style or CSS file
.something {
property: value;
}
<.p class="something">
Using the ID attribute
The ID attribute is used for one specific area of your webpage. The ID name is used by CSS and JavaScript. How to use the class? You either make a class in the style or CSS file
#something {
property: value;
}
<.p ID="something".> <./p>
The comment tag
You can add comments to your HTML source by using the following syntax:
<.!-- Write your comments here -->
Comments are great for debugging HTML, because you can comment out HTML lines of code, one at a time, to search for errors.