HTML and CSS Reference
ample uses the src (source) attribute to tell the browser that the image that you want to display is the image.jpg
file. You use the width attribute, with a value of 300 , to tell the browser that your image should be displayed 300
pixels wide, and the height attribute with a value of 100 to make it 100 pixels tall. The value of the alt attrib-
ute here provides some text that the browser might display if the image cannot be loaded. You learn more about the
<img> element, as well as lots of other content elements, in Chapter 4.
The <html> element is often used to define the language of the content within the document. This is done by
adding a lang attribute to the start tag that has a two-character language code as its value. (This applies only to the
actual page content and not to the tag names; they should always be written in English.) The following example
defines the content language as English by adding the lang attribute with the value ”en” . (I highlight the new por-
tion of the code with each new example so you can identify it easily.)
Ready to play with your code again? Let's define the content language for your web page.
The code for this exercise can be found in folder 2.
1. Open your index.html file in your text editor.
2. Now add the lang attribute to the <html> start tag and set its value to en .
<html lang="en" >
3. Save the index.html file.
You can find a full list of two-character language codes under the 'ISO 639-1 Code' column on the following web
The <head> Element
The first element contained within the <html> element should be a <head> element. This element contains in-
formation about the page, such as the title. Here's the <head> element from the sample code:
<title>My First Web Page</title>