1 CSS Styling with Fonts and Colors. 2 CSS Cascading Style Sheets and fonts CSS provides Style or Presentation options for our html pages CSS properties.

Slides:



Advertisements
Similar presentations
WEB PAGES: CREATING AND MAINTAINING ** Frank Romanelli Instructor: Wednesday: 10:15 -11:15 Week 3.
Advertisements

Part 3 Introduction to CSS. CSS Text Text Styles h1 {color: green} // rgb(0,255,0), #00ff00 h2{letter-spacing: 0.5cm} // 2px h3 {text-align: right} //
Measurement Many CSS properties (values within the declaration) require that you specify a unit of measurement, such as spacing between elements, border.
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
Week 7 Web Typography. 2 Understanding Type Design Principles.
CSS – CASCADING STYLE SHEETS Making your XHTML webpage look good.
Cascading Style Sheets (CSS) Why do we need them? Separate structure from browser presentation There are many HTML presentation attributes –We want to.
Workshop: CSS-Part I Cascading Style Sheets add style to your HTML web pages.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
WEB PAGES: CREATING AND MAINTAINING ** Tom Keane & Mayis SeapanInstructors: HTML Tags to format your text.
CSS Properties on Parade PropertyValid valuesExample font-familylist of fonts (separate with commas, end with generic font: serif, sans-serif, fantasy,
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
3.1 Cascading Style Sheets. Motto Fashions fade, style is eternal. —Yves Saint Laurent.
CSS The Definitive Guide Chapter 5.  You will understand why setting font properties will be among the most common uses of style sheets.  Font family.
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
Formatting Text (Plus More Selectors) Learning Web Design: Chapter 12.
Web Design – Sec 4-6 and 4-7 Part or all of this lesson was adapted from the University of Washington’s “Web Design & Development I” Course materials.
Selectors thru Borders. CSS – Cascading Style Sheets – is a way to style HTML HTML is the content base of a web page CSS provides the presentation qualities.
HIGHER COMPUTING CSS. WHAT IS CSS? CSS: Cascaded Style Sheets used to separate a web site’s content(information) from its style(how it looks).
Using Cascading Style Sheets. Introduction to Styles and Properties  Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium.
Cascaded Style Sheets Implementing web pages using only html/xhtml is tedious and awkward With CSS, you can design a component to be used in a web page.
CSCI N241: Fundamentals of Web Design Copyright ©2006  Department of Computer & Information Science More on Styles: Font, Text & Color.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
Cascading Style Sheets CSS. CSS - Structure Declaration block Property: identifies what to change Value: how to change it Selector – example h1{ font-size:
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
Cascading Style Sheets " Provide means to control and change presentation of HTML documents. " Allow the user to impose a standard style. " Three levels.
Just A Few More Fun Objectives 1 Having Some Fun With Java Script 2 Using Style Sheets.
Cascading Style Sheets Chapter Four. What are they? A set of style rules that tell the web browser how to present a web page or document. Cascading Style.
Class three: CSS review, backgrounds, font formatting, the box model.
Tutorial 5 Formatting with CSS. Objectives Session 5.1 – Evaluate why CSS styles are used – Determine where to write styles – Create an element selector.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
Most of the attributes of the body element specify colors for the Web page. Note: The background attribute won’t be useful till we learn about graphics.
ALBERT WAVERING BOBBY SENG. Week 2: HTML + CSS  Quiz  Announcements/questions/etc  Some functional HTML elements.
Introduction to CSS CSS Fonts - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Font Control Instructor: Joseph DiVerdi, Ph.D.,
Text and Fonts in CSS. Customizing fonts In CSS, fonts are divided into “font families” Only certain fonts are commonly installed on most computers Therefore.
Stylin’ with CSS Monday October 8 th and Tuesday October 9 th.
Files you will need ... Black Goose Bistro Summer Menu
Basics of Web Design Chapter 6 More CSS Basics Key Concepts.
Creating Your Own Webpage COSC Cascading Stylesheets Think of: HTML: content of your webpage HTML has tags CSS: presentation and appearance of your.
Cascading Style Sheets Eugenia Fernandez IUPUI. CSS Purpose CSS allow you to specify the style in which your XML elements are displayed. CSS were originally.
1 Web Development CSS (Cascading Style Sheet). 2 1.Setting rules for multiple elements To decrease the amount of typing for setting rules for multiple.
XHTML Formatting font with a style declaration. Formatting Font HTML uses the font tag to change size and family of font But… the font tag is being deprecated.
CSS for Styling CS The good, the bad and the… ugly!  Tags such as b, i, u, and font are discouraged in strict XHTML  Why is this bad? CS380 2.
Developing Web Applications with HTML and CSS “Selectors and Properties”
Web Design (14) CSS Formatting Text. Formatting Text In Brackets, go to your ‘externalcss’ website and find the ‘formattingtext’ page. Use the ‘main’
CSS Fonts. The Font properties allow you to change the font family, boldness, size, and the style of a text.
CSS Cascading Style Sheets *referenced from
Class & ID Selectors, Font and List Properties. Id Selectors  # followed by Id-name (without space)  Can be used once on a page  Examples: #p1 { color:
Basic Webpage Design Cascading Style Sheet (CSS).
Font-Family, Color and Background. Basics  CSS rule: Selector (multiple separated by, ) Declaration (multiple separated by ; ) Example: p { color: red;
Chapter 11 & 12 CSS Style Sheets: Intro. Why CSS? Separate presentation from content – more accessible Less work – can change appearance of whole site.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
CSS Details Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  To use CSS properties for fonts  Evaluate whether to use pts,
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 10: Formatting Text with Styles.
HTML WITH CSS.
Cascading Style Sheets Color and Font Properties
The Internet 10/11/11 Fonts and Colors
HTML WITH CSS.
CSS – Properties & Values
The Internet 10/13/11 The Box Model
Stylin’ with CSS.
Cascading Style Sheets Color and Font Properties
CSS Styles Fonts and Colors.
Stylin’ with CSS.
Stylin’ with CSS.
Cascading Style Sheets
Presentation transcript:

1 CSS Styling with Fonts and Colors

2 CSS Cascading Style Sheets and fonts CSS provides Style or Presentation options for our html pages CSS properties help you style your text CSS can control typeface, style, color, and even decorations CSS uses “font families” CSS “font families” specify the fonts to use in each element of your page

3 CSS font-family property Only certain fonts are commonly installed on most computers Care should be taken when specifying fonts body { font-family: Verdana, Geneva, Arial, san-serif; }

4 CSS font-size property CSS offers several ways to specify font sizes Can specify fonts in a way that allows your users to increase the font size without affecting your design body { font-size: 14px; }

5 CSS color property Changing the text color with the color property Use 16 predefined colors, RGB, or “hex codes” body { color: silver; }

6 CSS font-weight property Changing the weight of fonts with the font-weight property Use lighter, normal, bold, bolder body { font-weight: bold; }

7 CSS text-decoration property Decorate text with the text-decoration property Use none, underline, overline, line-through, blink body { text-decoration : underline; }

8 CSS font-family property font-family contains contains a set of fonts that share common charecteristics Five font families 1.Sans-serif 2.Serif 3.Monospace 4.Cursive 5.Fantasy Each family includes a larger set of fonts

9 font-family Sans-serif Sans-serif family Fonts without serifs (tails) Considered more readable on computer screens Examples: Verdana Arial Black Trebuchet MS Arial Geneva

10 font-family Serif Serif family Fonts with serifs (tails), the decorative barbs and hooks on the ends of the letters Elegant traditional look Associated with newspaper print Examples: Times Times New Roman Georgia

11 font-family Monospace Monospace family Fonts with constant width characters All characters share a same fixed width, typewriter look Useful for displaying with computer code Examples: Courier Courier New Andale Mono

12 font-family Cursive Cursive family Fonts that look handwritten Playful or stylized feel Useful for headings Examples: Comic Sans Apple Chancery

13 font-family Fantasy Fantasy family Stylized decorative fonts Not widely available or recommended for mainstream web design Useful for personal pages Examples: Last Ninja Impact

14 Specifying font-families Font family should contain a list of alternative fonts Alternative fonts should be from the same font family, but not required Font names must be spelled correctly Last font should be a generic system font like sans-serif or serif body { font-family: Verdana, Geneva, Arial, san-serif; }

15 Specifying font-families Browser interprets the fonts listed in your font-family specification, checks if font is installed on users computer Enables you to list preferred fonts Checks if Verdana is available, if not check for Geneva, if not check for Arial, if not use sans-serif (browser will use the default font in that family) body { font-family: Verdana, Geneva, Arial, san-serif; }

16 Specifying font-families Font-family property is set on the element Fonts with multiple words must be put in double quotes “Courier New” Any elements within, will inherit these fonts body { font-family: “Courier New”, san-serif; }

17 Font dilemma Can’t control what fonts users have installed on their computer Some fonts commonly appear on Mac’s but not PC’s Examples of fonts common on both Mac and PC: Andale Mono Arial Arial Black Comic Sans Courier New Georgia Impact Times New Roman Trebuchet MS Verdana

18 Specifying font size using px font-size property Can specify your font size in pixels (how many pixels tall to make letters) Specifying font-size will still enable user to increase the font size within their browser body { font-size: 14px; }

19 Specifying font size as relative Instead of specifying font size in pixels, a font size can be specified as a percentage Percentage specifies how big it should be relative to another font size body { font-size: 14px; } h1 { font-size: 150%; }

20 Specifying font size as relative Body font size in pixels and a level one heading as 150% of its parent element (body 14px) h1 heading will appear as 150% of 14px or approx 21px body { font-size: 14px; } h1 { font-size: 150%; }

21 Specifying font size using em Instead of specifying font size in pixels, or percentage, a font size can be specified using em em is another unit of measure, specifying a scaling factor body { font-size: 14px; } h1 { font-size: 150%; } h2 { font-size: 1.2em; }

22 Specifying font size using em Font-size for h2 will be scaled by 1.2 h2 heading will be 1.2 times the font size of the parent element (body 14px) h2 will be approx 17px body { font-size: 14px; } h1 { font-size: 150%; } h2 { font-size: 1.2em; }

23 Specifying font size using keywords Instead of specifying font size in pixels, or percentage, or em, another way is to instead use keywords Keywords are another way of defining size value Use xx-small, x-small, small, medium, large, x-large, or xx-large body { font-size: small; }

24 Specifying font size using keywords Use xx-small, x-small, small, medium, large, x-large, or xx-large Each size is about 20% larger than the previous size Each brand of browser may define sizing slightly different Font size of small will appear close to 12 pixels body { font-size: small; }

25 Font sizing recommendations Which sizing to choose? Use keywords small or medium for body font size Use either em or percentages to specify the other elements (like h1, h2), these elements will then be relative to your body size body { font-size: small; } h1 { font-size: 150%; } h2 { font-size: 120%; }

26 Problems with specifying font size using px Internet Explorer? (web browser) does NOT support text the resizing of font size (through browser) if font sizes are specified using pixels Using pixels will reduce the accessibility of your pages by many users If you use keywords for your body’s font size and then em or % Internet Explorer will properly scale if user adjusts font sizing through browser

27 Ideal Font properties example body { font-family: Verdana, Geneva, Arial, san-serif; font-size: small; } h1 { font-size: 170%; } h2 { font-size: 130%;}

28 CSS font-weight property Changing the weight of fonts with the font-weight property Allows you to control how heavy or bold, text will look Bolder and lighter are relative to its inherited value but are not supported consistently by browsers, thus not often used Use lighter, normal, bold, bolder body { font-weight: bold; }

29 Combining common properties Combine common properties into one rule, use comma body { font-family: Verdana, Geneva, Arial, san-serif; font-size: small; } h1, h2 { font-weight: normal; } h1 { font-size: 170%;} h2 { font-size: 130%;}

30 font-style property Italic text is slanted and has extra curls on the serif Not all fonts support the italic style, oblique displays instead body { font-style: italic; }

31 font-style property Oblique text is slanted using normal letters body { font-style: oblique; }

32 Childs getting font styles from parents Most elements get their font styles from their parents blockquote { font-style: italic; } The element below gets its font style from its parent welcome to my webpage

33 Specifying color using RGB Web colors are specified using RGB Red, Green, Blue Additive colors, mixing all three creates the color white Mixing portions of these three colors can create all the colors we will use Removing all three colors 0% Red, 0% Green, 0%

34 Specifying color by name Only 17 predefined named colors Aqua, Black, Blue, Fuchsia, Gray, Green, Lime, Maroon, Navy, Olive, Orange, Purple, Red, Silver, Teal, White, Yellow body { background-color: silver; }

35 Specifying color in red, green, blue values Specify the amount of red, green, blue Specify in percentage, amounts of each color body { background-color: rgb(80%, 40%, 0%) ; }

36 Specifying color in red, green, blue values Specify using the numeric value between 0 and 255 There are 256 different rgb colors Percentage relates to the color numeric value, 80% of 255 is 204 body { background-color: rgb(204, 102, 0) ; }

37 Specifying color in hex codes (recommended) Specify the amount of red, green, blue using the hex codes Start out with # then the first two digits represent red, the second two digits represent green, then the last two represent blue #CC6600 each set of two digits represent a number from 0 to 255, two digits made up of letters or numbers body { background-color: rgb(#CC6600 ) ; }

38 Hex codes based on 16 digits Ten digits 0 to 9 Six digits A-F Enables using a single digit to count from 0 to 15 –Hex value A B C D E F –Decimal value

39 Understanding Hex code color Separate hex color into its three components #CC6600 –Hex value CC –Color value Red Green Blue

40 Convert hex number into its decimal equivalent #CC6600 CC Red Green Blue For CC, use the left-most value C and determine its decimal value which happens to be 12 Hex value A B C D E F Decimal value CC has a decimal value of 12

41 Convert hex number into its decimal equivalent #CC6600 CC Red Green Blue C has a decimal value of 12 Times decimal value by * 16 = 192 Add total above with right most value (C, C=12) 12 to get decimal equivalent = is decimal equivalent of CC in hex

42 Convert hex number into decimal reviewed 5 steps #B817E0 B8 17 E0 1.Separate hex color into its three (color) components 2.Start with the first color, use the left-most value 11 in example above (determine its decimal value if a letter, B=11) 3.Times decimal value 11 by 16 to get pretotal 11*16=176 4.Add pretotal with right most value 8 (determine its decimal value if a letter) 176+8= decimal equivalent in hex

43 Convert hex number into its decimal equivalent #CC6600 CC Red Green Blue Repeat convert steps for each component CC –Hex value CC –Decimal equivelent

44 Hex code shorthand #ccbb00 = #cb0 #11eeaa = #1ea #ccbb10 can’t be abbreviated

45 Different ways to specify color For example: Orange color 80% red, 40% green, and 0% blue body { background-color: rgb(80%, 40%, 0%); } (percentage) body { background-color: rgb(204, 102, 0); } (Scale 0-255) body { background-color: rgb #cc6600; } (Hex code recommended)

46 CSS text-decoration property em { text-decoration : none; } em { text-decoration : underline; } em { text-decoration : overline; } em { text-decoration : line-through; } em { text-decoration : blink; } (not fully supported) em { text-decoration : overline overline; } (combining decorations to achieve both)

47 Websafe colors no longer important Almost all computers can now display millions of colors Don’t have to worry about web safe palette, that was so 10 years ago!

48 Ways to pick colors Color charts Do a online search for HTML Hex color chart Graphic applications Use a color picker to get the RGB and hex code

49 Color recommendations Use colors with high contrast for the text and background to aid readability Black text with White background has the highest contrast Use dark hues for text and light hue for the background Avoid blue and orange and red and blue together -end