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:
HTML codeDisplays in browser
<html> 
<head>
<title>Document title</title>
</head>
<body>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<p>Paragraph 4</p>
</body>
</html>

Paragraph 1

Paragraph 2

Paragraph 3

Paragraph 4

Line Breaks

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:
HTML codeDisplays in browser
<html> 
<head>
<title>Document title</title>
</head>
<body>
<h1>Heading 1</h1>
<p>Paragraph 1<br />
Line 2<br />
Line 3<br />
... </p>
<p>Paragraph 2</p>
</body>
</html>
Heading 1

Paragraph 1
Line 2
Line 3
...

Paragraph 2

- <br /> is an empty element, but may contain attribute (id, class, style).
Example:     <br id="idb" />

Horizontal rule

The <hr> (<hr /> for XHTML) 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 following attributes:
  - Example:
HTML codeDisplays in browser
<html> 
<head>
<title>Document title</title>
</head>
<body>
<h1>Heading 1</h1>
<p>Paragraph 1<br />
Line 2<br />
Line 3<br />
... </p>
<hr>
Some text ...
<hr color="#1111fe" size="4" width="50%">
<p>Paragraph 2</p>
</body>
</html>
Heading 1

Paragraph 1
Line 2
Line 3
...


Some text ...

Paragraph 2

- The preferred way of formatting a horizontal rule is by using CSS, adding an "id" or "class" attribute, or directly "style".
Example:     <hr style="width:50%; height:4px; color:#1111fe" />

Daily Test with Code Example

HTML
CSS
JavaScript
PHP-MySQL
What attribute makes an option from <select> selected?
checked="checked" selected="selected" disabled="disabled"
<select name="a_name">
 <option value="val1">Option 1</option>
 <option value="val2" selected="selected">Option 2</option>
</select>
What CSS value allows to create color gradients for background?
contain repeat-x linear-gradient
#id {
  background: linear-gradient(top left, #1f1, #fff, #11f);
}
What statement creates an array in JavaScript?
[] {} new Object()
var arr = [1, "CoursesWeb.net", "MarPlo.net"];
alert(arr[2]);
Indicate the PHP function used to redirect to other page.
function() header() switch()
header("Location: http://coursesweb.net/");
exit;
Paragraphs, Line break, Horizontal rule

Last accessed pages

  1. PHP Chat Script (4618)
  2. Writing CSS code (269)
  3. CSS Course - Free lessons (1175)
  4. Read Excel file data in PHP - PhpExcelReader (3549)
  5. Get and Modify content of an Iframe (1110)

Top accessed pages

  1. PHP-MySQL free course, online tutorials PHP MySQL code (5468)
  2. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (5268)
  3. Get Attribute (ID, Class, Name, Title, Src) with jQuery (5070)
  4. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (4855)
  5. PHP Chat Script (4618)