Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CSS Syntax Sample Configure a Web page to display blue text and yellow background. body { color: blue; background-color: yellow; } This could also be.

Similar presentations


Presentation on theme: "1 CSS Syntax Sample Configure a Web page to display blue text and yellow background. body { color: blue; background-color: yellow; } This could also be."— Presentation transcript:

1 1 CSS Syntax Sample Configure a Web page to display blue text and yellow background. body { color: blue; background-color: yellow; } This could also be written using hexadecimal color values as shown below. body { color: #0000FF; background-color: #FFFF00; }

2 2 Configuring Color with Inline CSS (1) Inline CSS Configured in the body of the Web page Use the style attribute of an XHTML tag Apply only to the specific element The Style Attribute Value: one or more style declaration property and value pairs Example: configure red color text in an element: Heading text is red

3 3 Configuring Color with Inline CSS (2) Example 2: configure the red text in the heading configure a gray backgroundin the heading Separate style rule declarations with ; This is displayed as a red heading with gray background

4 4 CSS Embedded Styles Configured in the header section of a Web page. Use the XHTML element Apply to the entire Web page document Style declarations are contained between the opening and closing tags The type attribute indicates the MIME type of text/css Example: Configure a Web page with white text on a black background body { background-color: #000000; color: #FFFFFF; } body { background-color: #000000; color: #FFFFFF; }

5 Configuring Text with CSS CSS properties for configuring text: font-weight Configures the boldness of text font-style Configures text to an italic style font-size Configures the size of the text font-family Configures the font typeface of the text

6 The font-size Property Accessibility Recommendation: Use em or percentage font sizes – these can be easily enlarged in all browsers by users

7 The font-family Property Not everyone has the same fonts installed in their computer Configure a list of fonts and include a generic family name p {font-family: Arial,Verdana, sans-serif;}

8 8 XHTML element A block-level element Purpose: configure a specially formatted division or area of a Web page There is a line break before and after the division. Can contain other block-level and inline elements Useful to define an area that will contain other block-level tags (such as paragraphs or spans) within it.

9 9 XHTML Element Example Configure a page footer area Embedded CSS:.footer { font-size: small; text-align: center; } XHTML: Copyright © 2009

10 10 XHTML element An inline-level element Purpose: configure a specially formatted area displayed in-line with other elements, such as within a paragraph. There is no line break before and after the span.

11 11 XHTML Element Example Embedded CSS:.companyname { font-weight: bold; font-family: Georgia, "Times New Roman", serif; font-size: 1.25em; } XHTML: Your needs are important to us at Acme Web Design. We will work with you to build your Web site.

12 Using an External Style Sheet To link to the external style sheet called color.css, the XHTML code placed in the header section is: body { background-color: #0000FF; color: #FFFFFF; } External Style Sheet color.css

13 Centering Page Content with CSS #container { margin-left: auto; margin-right: auto; width:80%; }

14 CSS Troubleshooting Tips Verify you are using the : and ; symbols in the right spots— they are easy to confuse. Check that you are not using = signs instead of : between each property and its value. Verify that the { and } symbols are properly placed Check the syntax of your selectors, their properties, and property values for correct usage. If part of your CSS works, and part doesn’t: Review your CSS Determine the first rule that is not applied. Often the error is in the rule above the rule that is not applied. Validate your CSS at http://jigsaw.w3.org/css-validator

15 The CSS border Property Configures a border on the top, right, bottom, and left sides of an element Consists of border-width border-style border-color h2 { border: 2px solid #ff0000 }

16 CSS Borders: Block / Inline Elements Block element default width of element content extends to browser margin (or specified width) Inline element Border closely outlines the element content h2 { border: 2px solid #ff0000; } a { border: 2px solid #ff0000; }

17 Browser Display Can Vary

18 Configuring Specific Sides of a Border Use CSS to configure a line on one or more sides of an element border-bottom border-left border-right border-top h2 { border-bottom: 2px solid #ff0000 }

19 The CSS padding Property Configures empty space between the content of the XHTML element and the border Set to 0px by default h2 { border: 2px solid #ff0000; padding: 5px; } No padding configured:

20 Configuring Padding on Specific Sides of an Element Use CSS to configure padding on one or more sides of an element padding-bottom padding-left padding-right padding-top h2 { border: 2px solid #ff0000; background-color: #cccccc; padding-left: 5px; padding-bottom: 10px; padding-top: 10px;}

21 CSS padding Property Shorthand: two values Two numeric values or percentages first value configures top and bottom padding the second value configures left and right padding h2 { border: 2px solid #ff0000; background-color: #cccccc; padding: 20px 10px; }

22 CSS padding Property Shorthand: four values Four numeric values or percentages Configure top, right, bottom, and left padding h2 { border: 2px solid #ff0000; width: 250px; background-color: #cccccc; padding: 30px 10px 5px 20px; }

23 Hands-On Practice h1 { background-color:#191970; color:#E6E6FA; padding: 15px; font-family: Georgia, "Times New Roman", serif; } h2 { background-color:#AEAED4; color:#191970; font-family: Georgia, "Times New Roman", serif; border-bottom: 2px dashed #191970; }

24 24 Types of Graphics Graphic types commonly used on Web pages: GIF JPG PNG

25 25 GIF Graphics Interchange Format Best used for line art and logos Maximum of 256 colors One color can be configured as transparent Can be animated Uses lossless compression Can be interlaced

26 26 JPEG Joint Photographic Experts Group Best used for photographs Up to 16.7 million colors Use lossy compression Cannot be animated Cannot be made transparent Progressive JPEG – similar to interlaced display

27 27 PNG Portable Network Graphic Support millions of colors Support multiple levels of transparency (but browsers do not -- so limit to one transparent color for Web display) Support interlacing Use lossless compression Combines the best of GIF & JPEG Browser support is growing

28 CSS background-image Property Configures a background-image By default, background images tile (repeat) body { background-image: url(background1.gif); }

29 CSS background-repeat Property

30 Using background-repeat h2 { background-color: #d5edb3; color: #5c743d; font-family: Georgia, "Times New Roman", serif; padding-left: 30px; background-image: url(trilliumbullet.gif); background-repeat: no-repeat; } trilliumbullet.gif:

31 31 Organizing Your Site Place images in their own folder Code the path to the file in the src atttribute

32 32 Image Maps element Defines the map element Defines a specific area on a map Can be set to a rectangle, circle, or polygon href Attibute shape Attribute coords Attribute

33 Sample Image Map

34 34 Overall Design Is Related to the Site Purpose Consider the target audience of these sites.

35 35 Web Site Organization Hierarchical Linear Random (sometimes called Web Organization)

36 36 Hierarchical Organization A clearly defined home page Navigation links to major site sections Often used for commercial and corporate Web sites

37 37 Hierarchical Too Shallow Be careful that the organization is not too shallow. Too many choices  a confusing and less usable web site Information Chunking “seven plus or minus two” principle George A. Miller found that humans can store only five to nine chunks of information at a time in short- term memory Many web designers try not to place more than nine major navigation links on a page or in a well-defined page area.

38 38 Hierarchical Too Deep Be careful that the organization is not too deep. This results in many “clicks” needed to drill down to the needed page. User Interface “Three Click Rule” A web page visitor should be able to get from any page on your site to any other page on your site with a maximum of three hyperlinks.

39 39 Linear Organization A series of pages that provide a tutorial, tour, or presentation. Sequential viewing

40 40 Random Organization Sometimes called “Web” Organization Usually there is no clear path through the site May be used with artistic or concept sites Not typically used for commercial sites.

41 41 Web Site Navigation Best Practices(1) Make your site easy to navigate Provide clearly labeled navigation in the same location on each page Most common – across top or down left side Provide “breadcrumb” navigation Types of Navigation Graphics-based Text-based Interactive Navigation Technologies Image Roll-overs Java Applet Flash DHTML fly-out or dropdown menus

42 42 Web Site Navigation Best Practices(2) Accessibility Tip Provide plain text links in the page footer when the main navigation is non-text media such as images, Flash, Java Applet or DHTML.

43 http://www.fdic.gov/consumers/consumer/alerts/ Text Based Navigation: http://www.usdoj.gov/http://www.usdoj.gov/ Graphic Based Navigation: http://www.dot.gov/index.cfmhttp://www.dot.gov/index.cfm Flash Navigation: http://www.loc.gov/wiseguide/sept08/index- flash.htmlhttp://www.loc.gov/wiseguide/sept08/index- flash.html DHTML: https://www.weber.edu/https://www.weber.edu/

44 44 Web Site Navigation Best Practices(3) Use a Table of Contents (with links to other parts of the page) for long pages. Consider breaking long pages in to multiple shorter pages using Linear Organization. Large sites may benefit from a site map or site search feature

45 45 Design Principles Repetition Repeat visual elements throughout design Contrast Add visual excitement and draw attention Proximity Group related items Alignment Align elements to create visual unity

46 46 Web Page Design Best Practices Page layout design Text design Graphic design Accessibility considerations

47 47 Web Page Design Load Time Watch the load time of your pages Try to limit web page document and associated media to under 60K on the home page

48 48 Web Page Design Target Audience Design for your target audience Appropriate reading level of text Appropriate use of color Appropriate use of animation

49 49 Web Page Design Colors & Animation Use colors and animation that appeal to your target audience Kids Bright, colorful, tons of animation Generation X,Y,Z,etc. Dark, often low contrast, more subtle animation Everyone: Good contrast between background and text Easy to read Avoid animation if it makes the page load too slowly Accessibility Tip: Many individuals are unable to distinguish between certain colors. See http://www.vischeck.com/showme.shtml http://www.vischeck.com/showme.shtml

50 50 Web Page Design Browser Compatibility Web pages do NOT look the same in all the major browsers Test with current and recent versions of: Internet Explorer Firefox, Mozilla Opera Mac versions Design to look best in one browser and degrade gracefully (look OK) in others

51 51 Web Page Design Screen Resolution Test at various screen resolutions Most widely used: 1024x768, 1280x1024, and 800x600 Design to look good at various screen resolutions Centered page content Set to either a fixed or percentage width

52 Wireframe A sketch of blueprint of a Web page Shows the structure of the basic page elements, including: Logo Navigation Content Footer

53 53 Web Page Design Page Layout(1) Place the most important information "above the fold" Use adequate "white" or blank space Use an interesting page layout This is usable, but a little boring. See the next slide for improvements in page layout.

54 54 Web Page Design Page Layout(2) Better Best Columns make the page more interesting and it’s easier to read this way. Columns of different widths interspersed with graphics and headings create the most interesting, easy to read page.

55 55 Text Design Best Practices Avoid long blocks of text Use bullet points Use short paragraphs

56 56 Text Design “Easy to Read” Text (1) Use common fonts: Arial, Helvetica, Verdana, Times New Roman Use appropriate text size: medium, 1em, 16px, 12 pt, 100 Use strong contrast between text & background Use columns instead of wide areas of horizontal text

57 57 Text Design “Easy to Read” Text (2) Bold text as needed Avoid “click here” Hyperlink key words or phrases, not entire sentences Separate text with “white space” or empty space. Chek yur spellin (Check your spelling)

58 58 Graphic Design Best Practices(1) Be careful with large graphics! Remember 60k recommendation Use the alt attribute to supply descriptive alternate text Be sure your message gets across even if images are not displayed. If using images for navigation provide plain text links at the bottom of the page. Use animation only if it makes the page more effective and provide a text description.

59 59 Graphic Design Recommended Practices(2) Choose colors on the web palette if consistency across older Windows/Mac platforms is needed Use anti-aliased text in images Use only necessary images Reuse images Goal: image file size should be as small as possible


Download ppt "1 CSS Syntax Sample Configure a Web page to display blue text and yellow background. body { color: blue; background-color: yellow; } This could also be."

Similar presentations


Ads by Google