Html Course

HTML contains several elements, tags and attributes, to display text in multiple formats with different layouts.

Text align

The text alignment can be defined with the text-align:value; css property, in style. The 'value' can be: left, center, right (default is left).

<div style="text-align:center;"> This text is displayed in the center of the Div. </div>

Size, font and color of text

In the style attribute you can add CSS properties to control the type, size, and color of the text displayed in the browser.
- The typeface can be changed with the css font-family:'font_type'; property.

<div style="font-family:'Arial Black';">This is the Arial Black font.</div>

- The text size can be changed with the css font-size property.
<div style='font-size:20px;'>Font with 20px size</div>

- The text color can be changed with the css color property, with a value of type: '#RRGGBB' or 'color name'.
<div style='colo:r#00c000;'>Text with font color #00c000</div>

Bold, Italic, Underline and other elements

Elements often used to format text (called formatting tags): - Often <strong> renders as <b>, and <em> renders as <i>. But <strong> or <em> means that you want the text to be rendered in a way that the user understands as 'important'.
<b> bold </b>
<i> italic </i>
<u> underline </u>
<em> emphasized </em>
<strong> strong </strong>

Other HTML tags for text formatting

- Set 1: Example:
Text within PRE tag after some space,
new line without a BR
<cite>Example of cite</cite>
- Set 2: Example:
<del>Deleted text</del><br>
<small>Display the text in smaller format</small><br>
<sub>Place text in subscript position</sub> Normal text <sup>Place text in superscript position</sup>
- Set 3 (The following tags are used for documents with technical applications): Example:
<p>DOM reference: <code>document.getElementById('id')</code></p>
<dfn>Truecolor</dfn> uses 24 bits per pixel.
<p>Provide alternative error messages to <samp>404 Not Found</samp>
<p>Example with <kbd>text in kbd</kbd> and some <var>$php_var</var>.</p>
- Set 4: Example:
I say: <q>If you want and you really believe, anything is possible.</q>
 <p>The unrequited joys can bring sadness and shared suffering can bring joy.</p>
 This is the first day of the rest of your life.
 <p>Patience with love and love with patience.</p>
<address>HTML Course:</address>

Daily Test with Code Example

Which type of <input> creates input fields that should contain a numeric value?
type="text" type="number" type="date"
<input type="number" name="points" min="5" max="80" />
Which CSS property allows to change the transparency of an element?
font-style opacity color
#id {
  filter:alpha(opacity=40);    /* for IE */
Click on the function that formats a number to specified number of characters.
toPrecision() exp() toFixed()
var num = 12.34567;
alert( num.toPrecision(3) );       // 12.3
Which function randomizes the order of the elements into an array?
natsort() shuffle() sort()
$lang =[10=>"PHP", 20=>"JavaScript", "site"=>"");
var_export($lang);     // array (0=>"", 1=>"PHP", 2=>"JavaScript")
HTML Text Formatting

Last accessed pages

  1. Read Excel file data in PHP - PhpExcelReader (80214)
  2. Making DIV Contents Scroll Horizontally, with multiple Div`s inside (56580)
  3. jsSHA - SHA Hashes and HMAC in JavaScript (809)
  4. Introduction to ActionScript 3 (2643)
  5. Display data from PHP Array, or MySQL in HTML table (20174)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (232)
  2. PHP-MySQL free course, online tutorials PHP MySQL code (158)
  3. Read Excel file data in PHP - PhpExcelReader (147)
  4. querySelector and querySelectorAll (103)
  5. Wake Up! (101)