Presentation is loading. Please wait.

Presentation is loading. Please wait.

Working with Fonts, Colors, and Graphics HTML: Tutorial 3.

Similar presentations


Presentation on theme: "Working with Fonts, Colors, and Graphics HTML: Tutorial 3."— Presentation transcript:

1 Working with Fonts, Colors, and Graphics HTML: Tutorial 3

2 Chang-Yang Lin, EKU2 Tutorial Objectives  Learn how HTML handles colors  Create foreground and background colors using styles  Select different font styles  Align text with surrounding content using styles  Control spacing between letters, words, and lines using styles  Learn about GIF, JEPG, PNG; animated graphics

3 Chang-Yang Lin, EKU3 Tutorial Objectives (continued)  Apply a background image  Float an image  Create image map hotspots and link them to destination documents

4 Chang-Yang Lin, EKU4 Working with Color in HTML HTML identifies a color in one of two ways:  by the color’s name red, maroon, green, black, blue, purple  by the color values To have more control and more choices, specify colors using color values.

5 Chang-Yang Lin, EKU5 The 16 Basic Color Names

6 Chang-Yang Lin, EKU6 Partial List of Extended Color Names

7 Chang-Yang Lin, EKU7 Basic Principles of Color Theory  Any color can be a combination of three primary colors: red, green, and blue.  By varying the intensity of each primary color, you can create almost any color. Yellow, magenta, cyan, and white are produced by adding the three primary colors.

8 Chang-Yang Lin, EKU8 RGB Triplets  Each color is represented by a triplet of numbers, called an RGB triplet, based on the strength of its Red, Green, and Blue. rgb (red, green, blue) where red, green, blue are the intensity values of the red, green, and blue components.  The intensity values range from 0 (absence of color) to 255 (highest intensity).  255 3 (or more than 16.7 million) colors can be defined.

9 Chang-Yang Lin, EKU9 Color Values in Hexadecimals  Color values can also be entered as hexadecimals in the form: #RedGreenBlue  A hexadecimal is a number based on base-16 hexadecimals include six extra characters: A (for 10), B (for 11), C (for 12), D (for 13), E (for 14), and F (for 15). 16 is expressed as “#10”, 17 as “#11”, 38 as “#26”, 165 as “#A5”, and 255 as “FF” in hexadecimal format.

10 Chang-Yang Lin, EKU10 A Typical Colors Dialog Box

11 Chang-Yang Lin, EKU11 Color Names, RGB Triplets, and Hexadecimal Values

12 Chang-Yang Lin, EKU12 Color Selection Resources Available on the Web  http://www.colormix.com  http://www.paletteman.com  http://www.two4u.com/color  http://www.zspc.com/color/index- e.html

13 Chang-Yang Lin, EKU13 Defining Foreground and Background Colors  The default browser scheme involves: black text on a white or gray background hypertext links highlighted in purple and blue  The syntax for controlling a page’s color scheme through the tag is:

14 Chang-Yang Lin, EKU14 Choosing a Font  By default, browsers display Web page text in a single font, usually Times New Roman.  You can specify a different font using the style font-family: fonts  Font names can be either specific or generic. Five generic fonts: serif, sans-serif, monospace, cursive, and fantasy. <p style=“text-align: center; font-family: Arial, Helvetica, sans-serif”>

15 Chang-Yang Lin, EKU15 Setting the Font Size The style to change the font size of the text within an element is: font-size: length length can be specified in four different ways: 1.with a unit of measurement 2.with a keyword description 3.as a percentage of the size of the containing element 4.with a keyword expressing the size relative to the size of the containing element

16 Chang-Yang Lin, EKU16 Setting the Font Size 1. with a unit of measurement  Use either absolute units or relative units  Absolute units define a font size using mm (millimeter) cm (centimeter) in (inch) pt (points) pc (pica)  1 inch = 72 points; 1 pc = 12 points  Absolute measurements are useful when you know the physical properties of the output device

17 Chang-Yang Lin, EKU17 Setting the Font Size 1. with a unit of measurement Relative units express font size relative to the size of a standard character on the output device. Two common standards:  The “em” unit is equal to the width of the capital letter “M”.  The “ex” unit is equal to the height of a lower case letter “x”. Font size will be 80% of normal body text Font size will be 150% of normal body text

18 Chang-Yang Lin, EKU18 Setting the Font Size (continued)  The following are equivalent: font-size: 1.5em and font-size: 150%  A value is expressed in pixels (a single dot) if no unit is specified. font-size: 20 equals font-size: 20px  Express font sizes using 7 keywords: xx-small x-small small medium large x-large xx-large A browser is configured to display text at a particular size for each of these keywords. Use “larger” or “smaller” to make a font one size larger or smaller.

19 Chang-Yang Lin, EKU19 Control Spacing: Kerning and Tracking  The style to control kerning (the amount of space between pairs of letters) and tracking ( the amount of space between words): letter-spacing: value word-spacing: value  The default value for both kerning and tracking is 0 pixels. A positive (negative) value increases (decreases) the letter and word spacing.  Kerning will be set to 1 em

20 Chang-Yang Lin, EKU20 Control Spacing: Leading and Indentation  The style to set the leading (the space between lines of text) is: line-height: length line-height: 1 represents the standard ratio (1.2:1), which means the line height is 1.2 times the font size  The style to set the indentation is: text-indent: value  Welcome Welcome will be indented 1 em

21 Chang-Yang Lin, EKU21 Setting other Font features  font-style: type type is normal or italic  font-weight: weight weight is normal, bold or 100,., 400 (normal),., 700 (bold),., 900  text-decoration: type type is none, blink, underline, overline, linethrough  text-transformation: type type is capitalize, uppercase, lowercase, none  font-variant: type type is normal (default) or small caps

22 Chang-Yang Lin, EKU22 Combining all Text Formatting in a Single Style  font: font-style font-variant font-weight font-size/line-height font-family  font: italic small-caps bold 16pt/24pt Arial, Helvetica, Sans-serif  content Font style will be normal, not italic Font size will be 0.8 em Text will be in Arial, Helvetica, or another Sans-serif font

23 Chang-Yang Lin, EKU23 Using the Span Element  Use the span element as a marker, and then change the font style.  Exciting adventures await you at Arcadium, your affordable family fun center. The...

24 Chang-Yang Lin, EKU24 GIF (Graphics Interchange Format)  The three image file formats supported by Web browsers are GIF, JPEG, and png.  GIF files are limited to displaying 256 colors.  Often used for graphics requiring fewer colors, such as clip art images, line art, logos, & icons.  With a noninterlaced GIF the image is saved one line at a time, starting from the top of the graphic and moving downward.  With interlaced GIFs, the image is saved and retrieved “stepwise.”

25 Chang-Yang Lin, EKU25 Transparent GIFs  A transparent color is a color from the image that is not displayed.  In place of a transparent color, the browser displays whatever is on the page background. logo background is transparent in the browser

26 Chang-Yang Lin, EKU26 Animated GIFs  One of the most popular uses of GIFs is to create animated images.  An animated GIF is composed of several images that are displayed one after the other in rapid succession.

27 Chang-Yang Lin, EKU27 JPEG (Joint Photographic Experts Group)  The JPEG format uses the full 16.7 million colors.  JPEG files are often used for photographs.  A JPEG file size can be controlled by the degree of image compression.  You cannot use transparent colors or animation with JPEG files.

28 Chang-Yang Lin, EKU28 Dithering  Dithering is when the colors in an image are converted to a fixed palette.  To completely eliminate dithering, use the Safety Palette. the Safety Palette or browser-safe palette is a collection of 216 colors that display consistently on different browsers.  Given the growth of 24-bit (millions of colors) color systems, this is rapidly becoming less of an issue.

29 Chang-Yang Lin, EKU29 Portable Network Graphics (PNG)  PNG files include such GIF features as animation, interlacing, and transparency but also provide the file compression available with JPEGs.  PNG supports 16.7 million colors.

30 Chang-Yang Lin, EKU30 Aligning an Image  float: position position is none (the default), left, or right  Use the clear style to prevent other content from wrapping around a floating element. Clear: position position is none (the default), left, or right  image floats at the right margin line will not be displayed until the right margin is clear

31 Chang-Yang Lin, EKU31 Setting the Image Margins  To set the size of the margins around an element, use the styles: margin-top: length; margin-right: length; margin-bottom: length; margin-left: length or margin: top right bottom left 

32 Chang-Yang Lin, EKU32 Setting the Image Size  To set the size of an image:  Height and width attributes instruct the browser to display an image at a specific size.  When a browser encounters an image, it calculates the image size and then uses this information to format the page. If the dimension is included, the browser displays the image faster.

33 Chang-Yang Lin, EKU33 Inserting a Background Image  Insert a background image: background-image: url(url)  Control the tiling of the background image: background-repeat: type type is repeat (default), repeat-x, repeat-y, or no-repeat  Place the background image in a specific location: background-position: horizontal vertical Specify a position as the distance from the top-left corner, a %, or using a keyword ( left center right for horizontal; top center bottom for vertical)

34 Chang-Yang Lin, EKU34 Inserting a Background Image  Control whether the background image scrolls: background-attachment: type type is scroll (default) or fixed  Place all of the background image: background: color image-file repeat attachment position 

35 rides.htmkarts.htmwater.htm Image map pointing to multiple pages

36 Chang-Yang Lin, EKU36 An Example of a Image Map an example of a park map that visitors can easily find their way to the different attractions by clicking on the image

37 Chang-Yang Lin, EKU37 Understanding Image Maps  To use a single image to multiple targets, you must set up hotspots within the image.  A hotspot is a defined area of the image that acts as a hypertext link.  Hotspots are defined through the use of image maps, which list the positions of all hotspots within an image.  A client-side image map is inserted in an image map into the HTML file.  The browser locally processes the image map.

38 Chang-Yang Lin, EKU38 Defining a Client-Side Image Map  Create an image map: hotspots map is the name of the image map hotspots are the locations of the hotspots within the map  To create XHTML-compliant code, include both the name and id attributes, setting them to the same value To access an image map:

39 Chang-Yang Lin, EKU39 Defining Image Map Hotspots  To create a rectangular hotspot: x1,y1,x2,y2 represents the upper-left and lower- right corners url is the location of the linked page  To create a circular hotspot: x,y indicate the coordinates of the center and r specifies the radius

40 Chang-Yang Lin, EKU40 Defining Image Map Hotspots: a polygonal hotspot x1,y1,x2,y2,x3,y3,... indicate the vertices of the polygon following the clockwise roller coaster rides (13, 60) (13, 270) (370, 270) (370, 225) (230, 225) (230, 60)

41 Chang-Yang Lin, EKU41 An Example: Image Map <area shape="circle" coords="255,133,74" href="karts.htm" alt="go-karts" /> <area shape="poly" coords="17,38,172,38, 172,223,333,223,333,300,17,300" href="rides.htm" alt="Roller coasters" />


Download ppt "Working with Fonts, Colors, and Graphics HTML: Tutorial 3."

Similar presentations


Ads by Google