Html Course


HTML Paragraphs

Paragraphs are defined with the <p> ... </p> tag.
Paragraphs may contain text and inline elements. They are block elements, but they may not contain other block elements, including other paragraphs.
The length of the displayed text will be adjusted by the opening size of the browser.
Browsers automatically add an empty line before and after a paragraph, so, the distance between two successive paragraphs is of two lines.


- Example:
<!DOCTYPE html>
<html>
<head>
<title>Document Title</title>
</head>
<body>
<h4>Example Paragraphs</h4>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<p>Paragraph 4</p>
</body>
</html>

Line Breaks - <br>

The <br> tag inserts a line break in the content, it allows you to control where to add new line breaks, to force the beginning of a new line at a particular poinnt.

- Example:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>Be Happy</h1>
<p>The Peace is Good.<br>
Line 2<br>
Line 3<br>
... </p>
<p>The smile brings joy.</p>
</body>
</html>
- <br> is an empty element, but may contain attribute (id, class, style).
Example:
<br id="idb">

Horizontal rule - <hr>

The <hr> tag creates a horizontal line in an HTML page.
The <hr> element can be used to divide a web page into different horizontal areas.
The <hr> tag is a block level element, and it uses the standard attributes: id, class, style.
With the CSS background proerty you can define the line color, and with the height property you can set the line thickness.


- Example:
<!DOCTYPE html> 
<html> 
<head>
<title>Document Title</title>
</head>
<body>
<h1>Page Title</h1>
<p>Paragraph 1<br>
Line 2<br>
Line 3<br>
... </p>
<hr>
<hr style='background:#1111fe; height:3px; width:50%;'>
<p>Paragraph 2</p>
</body>
</html>

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
Which tag is used to add lists into <ul> and <ol> elements?
<dt> <dd> <li>
<ul>
 <li>http://coursesweb.net/html/</li>
 <li>http://coursesweb.net/css/</li>
</ul>
Which value of the "display" property creates a block box for the content and ads a bullet marker?
block list-item inline-block
.some_class {
  display: list-item;
}
Which instruction converts a JavaScript object into a JSON string.
JSON.parse() JSON.stringify eval()
var obj = {
 "courses": ["php", "javascript", "ajax"]
};
var jsonstr = JSON.stringify(obj);
alert(jsonstr);    // {"courses":["php","javascript","ajax"]}
Indicate the PHP class used to work with HTML and XML content in PHP.
stdClass PDO DOMDocument
$strhtml = '<body><div id="dv1">CoursesWeb.net</div></body>';
$dochtml = new DOMDocument();
$dochtml->loadHTML($strhtml);
$elm = $dochtml->getElementById("dv1");
echo $elm->nodeValue;    // CoursesWeb.net
Paragraphs, Line break, Horizontal rule

Last accessed pages

  1. Mysql SELECT JOIN tables on two different Databases (4498)
  2. jQuery UI draggable - Drag elements (11448)
  3. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (142520)
  4. Using the Bone Tool (4253)
  5. Node.js Move and Copy Directory (20134)

Popular pages this month

  1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (523)
  2. The Mastery of Love (65)
  3. CSS cursor property - Custom Cursors (62)
  4. Read Excel file data in PHP - PhpExcelReader (59)
  5. PHP-MySQL free course, online tutorials PHP MySQL code (44)