Read: 05 - HTML Images; CSS Color & Text
From the Duckett HTML book:
Chapter 5: Images (pp.94-125)
- You might need insert these types of image in the website (logo, photograph, illustration, diagram, or chart.)
<img>used to add image and this is an empty element(has no closing tag).- suntax
<img src="URL" alt="alternate text" title="title" /> <img>element attributes:src-> image source.alt-> a text description of the image that describes the image it not seen.titleheightwidth
- Three rules to remember when you are creating images:
- Save images in the right format (whether jpg,gif and png).
- Save images at the right size(if it is smaller than intended-> might be distorted and stretched./ larger than intended -> will take longer to display on the page.)
- Use the correct resolution.
- Tools to Edit & Save Images -> ensure that the images are the right size, format, and resolution. *ex: * Adobe photoshop.
- JPEGs -> best for Photographs.
- Gif -> best for illustrations or logos.
- Vector images -> are used for creating logos, illustrations and print layouts.
-
Animated GIFs -> show several frames of an image in sequence.
<figure>-> we can use it to insert img element and caption.<figcaption>-> for figure caprion, can be inside<figure>.
Chapter 11: Color (pp.246-263)
- Three ways to specify colors in CSS:
- RGB Values.
- Hex Codes.
- a color name.
- color pickers enables us to find any color.
- A contrast between background and foreground colors; important for readability.
- With (Low Contrast) -> text is harder to read.
- (high Contrast) -> becomes easier to read.
- (Medium Contrast) -> For long spans of text, we can improve readability by reducing the contrast a little.
-
Opacity -> rgba(alpha value-> between 0.0 and 1.0 ): just like RGB value, but the fourth value is alpha value that indicates opacity; .5 = 5%.
- HSL Colors:
- Hue -> a degree on the color circle from 0 to 360.
- saturation -> is the amount of gray in a color; 100% full saturation & 0% shade to gray.
- lightness -> “is the amount of white (lightness) or black (darkness) in a color.” -0% lightness is black, 100% lightness is white-
- an opacity value for HSL is HSLA.
Chapter 12: Text (pp.264-299)
- Typeface Terminology :
- Serif -> extra details on the ends of the main strokes of the letters.
- Sans-Serif -> s have straight ends to letters.
- Monospace -> font is the fixed width.
Weight-> has a values of Light, Medium, Bold, and Black.Stylevalues -> Normal, Italic, and Oblique.Stretchvalues -> Condensed, Regular, and Extended.
-Specifying Typefaces:
The font-family property.font-size-> insert a number with (px or % or em or pt)@font-face-> for more font choice; specify inside it afont-familyandsrcto use a font not install in a person’s computer.text-transform-> uppercase, lowercase, and capitalize.text-decoration-> none, underline, overline, line-through, and blink.line-height-> “Leading (pronounced ledding) “ which define a vertical space between lines. ex line-height:3px;letter-spacing-> Kerning: a space between each letter.word-spacing-> space between each word.text-align-> left, right, center, and justify.vertical-align-> baseline, sub, super, top, text-top, middle, bottom, and text-bottom.text-indent-> indent first line of the text. ex: text-indent:15px;text-shadow-> create a drop shadow. ex: text-shadow: 1px 1px 0px #000000; first value: “ length indicates how far to the left or right the shadow should fall”, second value: “indicates the distance to the top or bottom that the shadow should fall. third value: (optional)- for amount of blur. last value: the color of the drop shadow.:first-letter,:first-line-> specify different values for the first letter or first line. example from book: p.intro:first-letter {font-size: 200%;}:link,:visited-> for link styling.:hover,:active,:focus-> “specify appearance of elements when a user is interacting with them.”
From Blog Post
JPEG vs PNG vs GIF
- JPEG, PNG and GIF format comprise more than 95% of all images loaded on websites.
TL;DR (Too Long; Didn’t Read)
- JPEG format -> for all images that contain a natural scene or photograph.
- PNG format-> for images that needs transparency or for images with text & objects with sharp contrast edges ex: logos.
- GIF format -> for images that contain animations.
Compression types :
- Lossless compression -> when image compressed image, there is no information loss during compression; so with decompression an image will appear like before a compression.
- Lossy compression -> compression ratio comes at a cost of reduced quality(some of the data from the original file is lost).
- JPEG is a lossy compression.
- PNG is a lossless image format using DEFLATE compression.
- GIF is also a lossless image format that uses LZW compression algorithm.
Transparency
like when we need a transparent background in logos.
- JPEG images don’t support transparency.
- PNG images support transparency in two ways — inserting an alpha channel that allows partial transparency(ideal with images with transparent background ) or by declaring a single colour as transparent (index transparency).
- GIF images support transparency by declaring a single colour in the colour palette as transparent (index transparency) so not ideal in all cases.
Colours
- JPEG images can support around 16 million colours.
- PNG images mainly have two modes:
- PNG8 -> can support up to 256 colours. (used for simple shapes with fewer colours)
- PNG24 can support up to 16 million colours. Use PNG8 and PNG24 (used for high quality, complex logos and shapes with rounded corners on a transparent background).
- GIF images -> 256 colours. If index transparency is used.
Animation
“Animation: is Any change or movement in the image. It doesn’t necessarily have to have frame rates like an animated video”
- only GIF supports animation.