Web Design with HTML and CSS

(National Geographic (Little) Kids) #1
Web languages

Lesson 4, Fundamentals of HTML, XHMTL, and CSS 65

6 Click to the right of the last quotation mark following the alt attribute, press the
spacebar, then type width="180" height="320". These attributes tell the web browser
how large the image should be displayed on the page. The values used are pixels. Keep
this document open as you will be working with it in the next exercise of this lesson.


Adding Width and Height values to your image is not required but is a good idea.

Using Optional Attributes


Many of HTML’s optional attributes fall under the category of best practices. Best practices is an
umbrella term used to describe the accepted way of doing something in web design. There are
generally logical reasons behind best practices; for example, setting the width and height creates
a placeholder for the images even if they haven’t loaded due to a slow Internet connection.
Without the placeholder created by the width and height values, the page layout will change as
the images load.

7 Choose File > Save and then preview your page in the browser to see your image.


The result of an embedded image as displayed in the browser.
Free download pdf