Introduction To CSS. Lesson 1: History of CSS CSS was proposed in 1994 as a web styling language. To helps solve some of the problems HTML 4. There were.

Slides:



Advertisements
Similar presentations
Intro To Cascading Style Sheets By Mario Yannakakis.
Advertisements

Cascading Style Sheets (CSS). Cascading Style Sheets With the explosive growth of the World Wide Web, designers and programmers quickly explored and reached.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
CSS. CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to solve a problem External Style.
Cascading Style Sheets
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
กระบวนวิชา CSS. What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to.
4.01 Cascading Style Sheets
Computing Concepts: CSS. Aims  To understand the uses of css  To understand the different types of css  To be able to create a css file  To be able.
HTML BASIC
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
Review HTML  What is HTML?  HTML is a language for describing web pages.  HTML stands for Hyper Text Markup Language  HTML is not a programming language,
IT Introduction to Website Development Welcome!
STYLING THE WEBSITE - EXTERNAL CSS BY JORGE MARTINEZ.
CSS Style Rules Guang Tong, Zhan L;lo’p[ Css Style Rule Guang Tong Zhan Three ways to insert CSS 1 External style sheet 2 Internal style sheet 3 Inline.
Cascading style sheets (CSS)
1 What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles are normally stored in Style Sheets  Styles.
To Proudly supported by ferrycake.com. We will be printing Cash for your Community tokens every week in the Carmarthen Journal and Llanelli Star. The.
ITCS373: Internet Technology Week 3: Introduction to CSS Dr. Faisal Al-Qaed.
Introduction To CSS.. HTML Review What is HTML used for? Give some examples of formatting tags in HTML? HTML is the most widely used language on the Web.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
INTRODUCTION TO CSS. OBJECTIVES: D EFINE WHAT CSS IS. K NOW THE HISTORY OF CSS. K NOW THE REASON WHY CSS IS USED. CSS SYNTAX. CSS ID AND CLASS.
CSS Basic (cascading style sheets)
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
DIV, Span, CSS.
Cascading Style Sheets CSS. Source W3Schools
Cascading Style Sheets
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Introduction To CSS by: Alexandra Vlachakis Sandy Creek High School, Fayette County Schools Content and Resources Used With Permission: Interact With Web.
CSS Syntax. Syntax The CSS syntax is made up of three parts: a selector, a property and a value: selector {property: value}
NASRULLAHIBA.  It is time to take your web designing skills to the next level with Cascading Style Sheets (CSS). They are a way to control the look and.
Introduction To CSS. History of CSS ► ► CSS was proposed in 1994 as a web styling language. To helps solve some of the problems HTML 4. ► ► There were.
1 Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size, font color etc…
CASCADING STYLE SHEET CSS. CSS stands for Cascading Style Sheets Styles define how to display HTML elements Styles were added to HTML 4.0 to solve a problem.
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
Cascading Style Sheets Part 1 1 IT 130 – Internet and the Web.
WEB FOUNDATIONS CSS Overview. Outline  What is CSS  What does it do  Where are styles stored  Why use them  What is the cascade effect  CSS Syntax.
Fall 2016 CSULA Saloni Chacha
Cascading Style Sheet.
Getting Started with CSS
4.01 Cascading Style Sheets
>> Introduction to CSS
Introduction to the Internet
Madam Hazwani binti Rahmat
Cascading Style Sheets (CSS)
CASCADING STYLE SHEET CSS.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
CSS Cascading Style Sheets
Website Design 3
Cascading Style Sheets - Building a stylesheet
CS134 Web Design & Development
Introduction to Cascading Style Sheets (CSS)
What are Cascading Stylesheets (CSS)?
Training & Development
Tutorial 3 Working with Cascading Style Sheets
Web Design & Development
Cascading Style Sheet.
Cascading Style Sheets
Cascading Style Sheets - Building a stylesheet
Stylin’ with CSS.
4.01 Cascading Style Sheets
5.00 Apply procedures to organize content by using Dreamweaver. (22%)
Cascading Style Sheets III B. Com (Paper - VI) & III B
Web Programming and Design
CGS 3066: Web Programming and Design Fall 2019
Presentation transcript:

Introduction To CSS

Lesson 1: History of CSS CSS was proposed in 1994 as a web styling language. To helps solve some of the problems HTML 4. There were other styling languages proposed at this time, such as Style Sheets for HTML and JSSS but CSS won. CSS2 became the recommendation in 1998 by W3C CSS3 was started in 1998 but it has never been completed. Some parts are still being developed and some components work on some browsers.

CSS stands for Cascading Style Sheets Styles - define how to display HTML elements Styles are normally stored in Style Sheets Definition: Cascading Style Sheets (CSS) – is a rule based language that applies styling to your HTML elements. You write CSS rules in elements, and modify properties of those elements such as color, background color, width, border thickness, font size, etc. What is CSS?

Lesson 1: Examples of CSS Example 1: Example 2: If you notice each time we click on a different CSS style sheet on the two pages above the look and feel of each page changes dramatically but the content stays the same. HTML did not offer us this option. HTML was never intended to contain tags for formatting a document. HTML was intended to define the content of a document, like: This is a heading This is a paragraph. When tags like, and color attributes were added to the HTML 3.2 specification, it started a nightmare for web developers. Development of large web sites, where fonts and color information were added to every single page, became a long and expensive process. To solve this problem, the World Wide Web Consortium (W3C) created CSS.

HTML Formatting Review What are the starting tags in HTML? What are the ending tags in HTML? How do you save in a Notepad document so it becomes a web page? What is the tag for creating paragraphs in HTML? What is the tag for creating heading tags in HTML? What are the tags we use to format font: family, color, size, alignment in HTML?

Syntax oF CSS The CSS syntax is made up of 5 parts: selector property/value declaration declaration block curly braces

Selector Definition: identifies the HTML elements that the rule will be applied to, identified by the actual element name, e.g., or by other means such as class attribute values. Example: *The selector is normally the HTML element you want to style

Property & Value Definition: The property is the style attribute you want to change. Each property has a value. *Properties are separated from their respective values by colons : Pairs are separated from each other by semicolons ; *Pairs are separated from each other by semicolons ;

Declaration Definition: Each CSS line that includes property and value *Each declaration consists of a property and a value.

Declaration Block  Definition: multiple declaration lines including the curly braces

Curly Braces Definition: the curly braces contain the properties of the element you want to manipulate, and the values that you want to change them to. The curly braces plus their content is called a declaration block. Example:

Let’s Create Our First CSS Page Open Notepad Type the following Code p {color:red; text-align:center;} Hello World! This paragraph is styled with CSS. Save Your File as css-myfirstpage.html into a new folder called CSS

Class and id Selectors In addition to setting a style for a HTML element, CSS allows you to specify your own selectors called "id" and "class". id - The id selector is used to specify a style for a single, unique element. The id selector uses the id attribute of the HTML element, and is defined with a "#". The style rule below will be applied to the element with id="para1": #para1 {text-align:center;color:red;}

Class and id Selectors Class - The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements. This allows you to set a particular style for any HTML elements with the same class. The class selector uses the HTML class attribute, and is defined with a "." In the example below, all HTML elements with class="center" will be center-aligned:.center {text-align:center;}

Class and id Selectors In the image below what is the h1 selector an ID or a Class? #.

Let’s Create A CSS Page that uses “id” Open Notepad Type the following Code #para1 { text-align:center; color:red; } Hello World! This paragraph is not affected by the style. Save Your File as css-id.html into a your folder called CSS.

Let’s Create A CSS Page that uses “class” Open Notepad Type the following Code.center { text-align:center; } Center-aligned heading Center-aligned paragraph. Save Your File as css-class.html into a your folder called CSS.

Comments Comments are used to explain your code, and may help you when you edit the source code at a later date. Comments are ignored by browsers. You add comments by enclosing them in /* and */ Comments can span several lines, and the browser will ignore these lines. Example: /* This is a basic comment it will not appear on the page*/ /* starts the comment */ is the end of the comment /*This is a comment*/ p{ text-align:center; color:black; font-family:arial;}

: Let’s Add A Comment Open Your CSS-ID example in Notepad Type the following Code right above the style you had written previously. /*This is an example of how to use ID in a CSS web page*/ #para1 { text-align:center; color:red; } Hello World! This paragraph is not affected by the style. Save Your File as css-comment.html into a your folder called CSS.

How CSS is Applied to A Web Page CSS is applied to a web page using three different methods: Inline style Internal style sheet External style sheet

How CSS is Applied to A Web Page Inline CSS Applies styles directly to the elements by adding declarations into the style For Example: This is a simple paragraph and the inline style makes it red.

How CSS is Applied to A Web Page Internal Style Sheet Applies styles to HTML by placing the CSS rules inside the tag inside the document tag. For Example: my page p{color:red} this is a simple paragraph

How CSS is Applied to A Web Page External CSS Applies styles as a separate file with a.css extension. The file is then referenced from inside the element by a link to the file. For Example: my external style sheet page this is a simple paragraph You can create an external style sheet in your text editor.

How CSS is Applied to A Web Page What style sheet is best? Web developers rarely use inline CSS. Since they prefer to not mix content with presentation. And it is not efficient since you have to declare the style individually for every component. Internal and External style sheets are more popular because you can style multiple elements with one rule. External style sheets are best because they allow you to save all the style information on a separate file from the content. You can then modify a style for a site and it will update all of the pages in a site.

Colors and Formatting in CSS CSS Colors In the previous lesson you have seen a few CSS styles that included color like: There are a few ways that you can set colors in CSS: Keywords, Hex values, RGB, HSL(a)

Colors and Formatting in CSS CSS Colors: Keywords Using the keywords like: red, fuchsia, yellow, blue, green you can specify what color you would like the CSS rule to display. For example: p{color:red} h2{color:yellow} There are 17 of these keyword colors you can use in CSS.

Colors and Formatting in CSS Keyword Color Hex aqua#00ffff black# blue#0000ff fuchsia#ff00ff gray# green# lime#00ff00 maroon# navy# olive# orange (added in CSS 2.1)#ffa500 purple# red#ff0000 silver#c0c0c0 teal# white#ffffff yellow#ffff00

Colors and Formatting in CSS Computers are capable of displaying a lot more than 17 colors. In fact they can display approximately 16.7 million colors! Hex Values (hex is short for hexadecimal) are the most common way of specifying colors for web pages. (see hex# in the previous chart) For example: p{color: #000000;} /*This is equivalent to the keyword black*/

Colors and Formatting in CSS Hex numbers - has 16 possible values 0 to 9 then A to F. Which gives you 16 values. RGB (Red Green Blue) has the possibility of 256 colors for each (16x16) (R)256 x (G)256 x (B)256 = 16,777,216 or 16.7 million color values CSS example: h1{color: #000000;}

Colors and Formatting in CSS RGB (a) can also help specify colors in CSS RGB stands for Red Green Blue You can specify RGB in either whole numbers or percentages CSS example: h1{color: rgb(0,0,0) } /*this color is equivalent to # or black */ You use numbers from 0 to 255 which covers the 256 color range.

Colors and Formatting in CSS RGB (a) can also help specify colors in CSS RGB stands for Red Green Blue. The “a” stands for alpha but we will learn about that in another lesson. You can specify RGB in either whole numbers or percentages CSS example: h1{color: rgb(0,0,0) } /*this color is equivalent to # or black */ You use numbers from 0 to 255 which covers the 256 color range.

Colors and Formatting in CSS HSL (a) - Hue Saturation Lightness Similar to RGB but based on saturation and lightness of a color The “a” stands for alpha but we will learn about that in another lesson. CSS example: h1{color: hsl(0,100%,40%) } HSL accepts a number between 0 to 360 in value HSL also accepts percentage between 0-100%

: CSS Using Color Open Your CSS-ID example in Notepad Type the following Code right above the style you had written previously. Color set by using hex value Color set by using rgb value Color set by using color name Save Your File as css-color.html into your folder called CSS