ult.htm ult.htm This website illustrates the use of CCS (style sheets)

10
Introduction to CSS

Transcript of ult.htm ult.htm This website illustrates the use of CCS (style sheets)

Page 1: ult.htm  ult.htm  This website illustrates the use of CCS (style sheets)

Introduction to CSS

Page 2: ult.htm  ult.htm  This website illustrates the use of CCS (style sheets)

http://www.w3schools.com/css/demo_default.htm

This website illustrates the use of CCS (style sheets)

What are the main differences in each of the different pages.

Cascading Style Sheets (CSS)

Page 3: ult.htm  ult.htm  This website illustrates the use of CCS (style sheets)

CSS stands for Cascading Style Sheets CSS is a simple mechanism for adding style

(e.g., fonts, colors, spacing) to Web documents.

CSS saves a lot of work External Style Sheets are stored in CSS

files◦ By making changes in one external style

sheet you can change the look of a full website.

What is CSS?

Page 4: ult.htm  ult.htm  This website illustrates the use of CCS (style sheets)

3 ways In-line style Internal style External Style sheet

Adding style to a webpage

Visit this site form more information on thishttp://www.w3schools.com/css/css_howto.asp

Page 5: ult.htm  ult.htm  This website illustrates the use of CCS (style sheets)

In line style puts the style with the element for example <H1>, <P> etc.

Inline styles are easy and quick to add. You don’t have to create a separate document.

Inline styles must be applied to every element you want them on. So if you want all your paragraphs to look the same with colour, font etc you have to add an inline style to each <p> tag in your document.

This can take a lot of time. Difficult to make changes to all the styles

In line style

Page 6: ult.htm  ult.htm  This website illustrates the use of CCS (style sheets)

An internal style sheet should be used when a single document has a unique style.

Internal styles are put in the head section of an HTML page, inside the <style> tag, like this:

Most useful when testing out styles

Internal style sheet

Page 7: ult.htm  ult.htm  This website illustrates the use of CCS (style sheets)

Contains number of styles put together in one file.

CSS files are saved with an .css extension. (ending)

This file is then linked to HTML files It can be used when the style is applied to

many pages. You can change the look of an entire Web

site by changing just one file.

External Style sheet

Page 8: ult.htm  ult.htm  This website illustrates the use of CCS (style sheets)

Each page must include a link to the style sheet with the <link> tag. The <link> tag goes inside the head section:

Page 9: ult.htm  ult.htm  This website illustrates the use of CCS (style sheets)

Separate content from designOne of the main goals of CSS is to remove the design elements from the HTML and place them in another location for the designer to maintain. That means that a designer doesn't have to also be the content developer to maintain the look of the Web site.

Make maintenance easyOne of the most forgotten elements of Web design is the maintenance. Unlike print materials, once you put out a Web "magazine" it doesn't go away. Things change - from the look of your site to the content and links within it. And having your CSS in a central place makes it that much easier to maintain.

Keep your site accessibileUsing CSS styles can keep your site more accessible both to disabled people and to robots like search engines.

Your site will stay current longerBy using best practices with your CSS, you're using standards that have been proven to work and remain flexible as the Web design environment changes.

CSS best practice

Page 10: ult.htm  ult.htm  This website illustrates the use of CCS (style sheets)

CSS Syntax A CSS rule set consists of a selector and a

declaration block: The selector points to the HTML element

you want to style. The declaration block contains one or more

declarations separated by semicolons. Each declaration includes a property name

and a value, separated by a colon.