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:
- src - Contains the location (URL address) of the file with the image.
- alt - At this attribute you write the text that will appear if the image cannot be displayed.
- width - The width of the image in pixels, if it's not specified the image will maintain it's original width.
- height - The image's heigth, in pixels. If it's not specified the image will be presented in it's orininal heigth.
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.
Example::
<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
HTML
CSS
JavaScript
PHP-MySQL
What attribute makes the input text box to not be modified by the user?
checked="checked" readonly="readonly" disabled="disabled"<input type="text" value="fixed-value" readonly="readonly" name="a_name" />
What CSS property allows you to create rounded corners in your webpage design?
background-size border-size border-radius.class {
border:2px solid blue;
border-radius:1.2em;
}
What instruction displays a confirmation dialog box to the viewer, who must then click OK or Cancel to proceed?
indexOf() confirm() prompt()var ques = window.confirm("The result of 0+0 is 0?");
if (ques) alert("Corect");
else alert("Incorrect");
Indicate the PHP function that returns the lowest number of the parameter values.
floor() ceil() min()$min_nr = min(12, 8, 25, 13);
echo $min_nr; // 8