HTML contains elements for adding images to your website.
The formats most used for the images added in a HTML page are GIF and JPEG (JPG ; JPE), the advantage of GIF images is that are small in size (in bytes), having a maximum of 256 colors.
Other format types that can be used are: PNG, BMP, TIFF, PCX

Adding image in HTML page

To add an image in a HTML document you can use the <img> tag and the following attributes:

In the following example you can see how you can include an image in your web page and how to use these attributes:
<h4>Example adding image</h4>

<img src='../imgs/smile_gift.png' alt='smile' width='150' height='132'>
- In the <img> tag you can add the style attribute with CSS properties to set the border, position and margins for image.
<h4>Example image and style</h4>

<img src='../imgs/smile_gift.png' alt='smile' width='150' height='132' style='border:2px solid #0000ee; margin:5px 25px;'>

Daily Test with Code Example

Which tag is used to add lists into <ul> and <ol> elements?
<dt> <dd> <li>
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"></div></body>';
$dochtml = new DOMDocument();
$elm = $dochtml->getElementById("dv1");
echo $elm->nodeValue;    //
Adding images in page

Last accessed pages

  1. jsSHA - SHA Hashes and HMAC in JavaScript (140)
  2. Insert, Select and Update NULL value in MySQL (47985)
  3. Add /Delete rows in HTML table with JavaScript (1065)
  4. dompdf (2538)
  5. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (99695)

Popular pages this month

  1. Making DIV Contents Scroll Horizontally, with multiple Div`s inside (2065)
  2. Contact page - CoursesWeb (2004)
  3. Tabs effect with CSS (2003)
  4. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (642)
  5. Insert, Select and Update NULL value in MySQL (515)