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 HTML5 tag is indicated to be used as container for menu with navigation links in Web site?
<section> <nav> <article>
 <li><a href="" title="CSS Course">CSS Course</a></li>
 <li><a href="" title="Flash Games">Flash Games</a></li>
Which CSS property shifts an item horizontally to the left or right of where it was?
text-align clear float
.some_class {
  width: 30%;
  float: left;
Click on the Math object method which returns x, rounded downwards to the nearest integer.
Math.ceil(x) Math.abs(x) Math.floor(x)
var num = 12.34567;
num = Math.floor(num);
alert(num);       // 12
Indicate the PHP function which returns the number of characters in string.
mb_strlen() count() stristr()
$str = "string with utf-8 chars åèö";
$nrchr = mb_strlen($str);
echo $nrchr;        // 30
Adding images in page

Last accessed pages

  1. Horizontal-Vertical Menu with Arrow Keys Navigation (1833)
  2. Ajax-PHP Rating Stars Script (14122)
  3. PHP getElementById and getElementsByTagName (32878)
  4. Convert XML to JSON in PHP (9209)
  5. Script Users Register, Login, Online (17008)

Popular pages this month

  1. Making DIV Contents Scroll Horizontally, with multiple Div`s inside (1440)
  2. Contact page - CoursesWeb (1403)
  3. Tabs effect with CSS (1398)
  4. PHP getElementById and getElementsByTagName (660)
  5. Get Attribute (ID, Class, Name, Title, Src) with jQuery (537)