Lesson 3.1 HTML Documents 1
Lesson 3.1 HTML Documents 1
1
HTML DOCUMENTS
HTML Elements
An HTML element is defined by a start tag, some content,
and an end tag.
HTML Elements
The HTML element is everything from the start tag to the
end tag:
<html>
<body>
<p>HTML links are defined with the a tag. The link address is specified in the
href attribute:</p>
</body>
</html>
The src Attribute
The <img> tag is used to embed an image in an HTML page. The src attribute specifies the path to the
image to be displayed:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
The width and height
Attributes
The <img> tag should also
contain the width and height
attributes, which specify the
width and height of the image
(in pixels):
The alt Attribute
The required alt attribute for the <img> tag specifies an alternate text for
an image, if the image for some reason cannot be displayed.
This can be due to a slow connection, or an error in the src attribute, or if
the user uses a screen reader.
<!DOCTYPE html>
<html>
<body>
<img src= " SAD GIRL.jpg" alt= "A SAD GIRL" width="500" height="600">
</body>
</html>
The title Attribute
The title attribute defines some extra information about an element.
The value of the title attribute will be displayed as a tooltip when you mouse
over the element:
<!DOCTYPE html>
<html>
<body>
</body>
</html>