reading-notes

this repo will contain my reading during the course .

View on GitHub
class-05
From the Duckett HTML book

Images

Choosing Images for Your Site

A picture can say a thousand words, and great images help make the difference between an average-looking site and a really engaging one.

Adding Images

To add an image into the page you need to use an img element. This is an empty element (which means there is no closing tag). It must carry the following two attributes: - src This tells the browser where it can find the image file. This will usually be a relative URL pointing to an image on your own site. (Here you can see that the images are in a child folder called images —relative URLs were covered on pages 83-84). - alt This provides a text description of the image which describes the image if you cannot see it. Title You can also use the title attribute with the img element to provide additional information about the image. Most browsers will display the content of this attribute in a tootip when the user hovers over the image.

Height & Width of Images

You will also often see an img element use two other attributes that specify its size: Height This specifies the height of the image in pixels. Width This specifies the width of the image in pixels

Where to Place Images in Your Code

  1. before a paragraph
  2. inside the start of a paragraph
  3. in the middle of a paragraph

Old Code: Aligning Images Horizontally

Three Rules for Creating Images There are three rules to remember when you are creating images for your website which are summarized below.

  1. Save images in the right format
  2. Save images at the right size
  3. Use the correct resolution

There are several tools you can use to edit and save images to ensure that they are the right size, format, and resolution.

Image Formats:

Image Formats

Cropping Images

Cropping Images

Image Resolution

Images created for the web should be saved at a resolution of 72 ppi. The higher the resolution of the image, the larger the size of the file.

Vector Images

Vector images differ from bitmap images and are resolution-independent. Vector images are commonly created in programs such as Adobe Illustrator.

Animated GIFs

Animated GIFs show several frames of an image in sequence and therefore can be used to create simple animations.

HTML5: Figure and Figure Caption

Images often come with captions. HTML5 has introduced a new figure element to contain images and their caption so that the two are associated. You can have more than one image inside the figure element as long as they all share the same caption.

The figcaption element has been added to HTML5 in order to allow web page authors to add a caption to an image.Before these elements were created there was no way to associate an element with its caption.

Colors

The color property allows you to specify the color of text inside an element. You can specify any color in CSS in one of three ways:

  1. rgb values These express colors in terms of how much red, green and blue are used to make it up. For example: rgb(100,100 90)
  2. hex codes These are six-digit codes that represent the amount of red, green and blue in a color, preceded by a pound or hash # sign.For example: #ee3e80 color
  3. names There are 147 predefined color names that are recognized by browsers. For example: DarkCyan

Every color on a computer screen is created by mixing amounts of red, green, and blue. To find the color you want you can use a color picker.

CSS3: HSL Colors

CSS3 introduces an entirely new and intuitive way to specify colors using hue, saturation, and lightness values.

Learn more about CSS

Text

Typeface Terminology

  1. Serif: Serif fonts have extra details on the ends of the main strokes of the letters. These details are known as serifs.
  2. Sans-Serif Sans-serif fonts have straight ends to letters, and therefore have a much cleaner design.
  3. Monospace Every letter in a monospace (or fixed-width) font is the same width. (Non-monospace fonts have different widths.)

Fonts:

Indenting Text text-indent The text-indent property allows you to indent the first line of text within an element. The amount you want the line indented by can be specified in a number of ways but is usually given in pixels or ems.

@font-face allows you to use a font, even if it is not installed on the computer of the person browsing, by allowing you to specify a path to a copy of the font, which will be downloaded if it is not on the user’s machine.

font-family

This specifies the name of the font. This name can then be used as a value of the font-family property in the rest of the style sheet (as shown in the rule for the *h1 and h2 elements).*

src

This specifies the path to the font. In order for this technique to work in all browsers, you will probably need to specify paths to a few different versions of the font, as shown on the next page.

Format

This specifies the format that the font is supplied in. (It’s discussed in detail on the next page.)

CSS3: Drop Shadow >text-shadow

The text-shadow property has become commonly used despite lacking support in all browsers. It is used to create a drop shadow, which is a dark version of the word just behind it and slightly offset. It can also be used to create an embossed effect by adding a shadow that is slightly lighter than the text

You can use pseudo-classes to change the style of an element when a user hovers over or clicks on text, or when they have visited a link.

JPEG vs PNG vs GIF

Photographs are best saved as JPEGs; illustrations or logos that use flat colors are better saved as GIFs.

Colours

There is a significant difference in the number of colours that can be supported by these 3 formats.

Of these 3 formats, only GIF supports animation. This capability makes GIF format suitable for delivering engaging ads and banners.

Read more about this article