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.

Slides:



Advertisements
Similar presentations
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Advertisements

CSS Cascading Style Sheets. Contents{ 1. What is CSS? 1. A Brief History of CSS 2. Why to use Styles? 2. Syntax 3. Cascading Order 4. Examples of Properties.
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.
Computer Applications II.  A Style Sheet is a web page development tool that allows the developer to make global changes to a web page (or web site)
Making Things Look Nice: Visual Appearance and CSS CMPT 281.
Introduction to CSS.
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.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
กระบวนวิชา 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.
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
CSS Cascading Style Sheets Brief Introduction
1 Creating Web Pages Part 3. 2 CASCADING STYLE SHEETS (CSS): What exactly are they? Set of rules that define how a web browser should display an HTML.
CSS Pertemuan 12 Matakuliah: L0182 / Web & Animation Design Tahun: 2008.
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.
Using Cascading Style Sheets (CSS) Dept. of Computer Science and Computer Information CSCI N-100.
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,
Cascading Style Sheets (CSS) Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
Cascading Style Sheets Example
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.
The Characteristics of CSS
SEG3210 DHTML Tutorial. DHTML DHTML is a combination of technologies used to create dynamic and interactive Web sites. –HTML - For creating text and image.
CSS Netcentric. What is CSS O CSS stands for Cascading Style Sheets O Styles define how to display HTML elements O Styles were added to HTML 4.0 to solve.
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.
CO1552 – Web Application Development Cascading Style Sheets.
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)
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
IS1825: Developing Multimedia Applications for Business Lecture 1: Introduction to CSS Rob Gleasure
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Chapter 3 CSS. Vacabulary CSS: 层叠样式表 Syntax: 语法 Selector: 选择器 filter :滤镜 / 过滤器 background: 背景 property: 属性.
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
DIV, Span, CSS.
Cascading Style Sheets CSS. Source W3Schools
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
Designing Web Pages The case for CSS. The Power of CSS css Zen Garden
How to… Cascading Style Sheets. How to Insert a Style Sheet When a browser reads a style sheet, it will format the document according to it. There are.
CSS Syntax. Syntax The CSS syntax is made up of three parts: a selector, a property and a value: selector {property: value}
1 CSS محمد احمدی نیا 2 Of 21 What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements 
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
CSS DHS Web Design. Location Between the & Start with – End with –
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.
Cascading Style Sheets Using HTML. What are they? A set of style rules that tell the web browser how to present a web page or document. In earlier versions.
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.
1 Cascading Style Sheets
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.
WebD Introduction to CSS By Manik Rastogi.
CSS.
Cascading Style Sheet.
4.01 Cascading Style Sheets
Introduction to the Internet
Madam Hazwani binti Rahmat
Cascading Style Sheet (CSS)
CASCADING STYLE SHEET CSS.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
CSS Cascading Style Sheets
Website Design 3
Cascading Style Sheets - Building a stylesheet
محمد احمدی نیا CSS محمد احمدی نیا
Web Programming– UFCFB Lecture 11
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets - Building a stylesheet
4.01 Cascading Style Sheets
CGS 3066: Web Programming and Design Fall 2019
Presentation transcript:

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 were added to HTML 4.0 to solve a problem  External Style Sheets can save you a lot of work  External Style Sheets are stored in CSS files  Multiple style definitions will cascade into one  With CSS, your HTML document can be displayed using different output styles

2 Advantages of CSS? With CSS, you will be able to: - define the look of your pages in one place rather than repeating yourself over and over again throughout your site. (Ever get tired of defining colors and fonts each time you start a new cell in a table? Those days are over with CSS!) - easily change the look of your pages even after they're created. Since the styles are defined in one place you can change the look of the entire site at once. (Ever get tired of replacing tags throughout your site when you want to change the look of a certain element? Those days are over with CSS!)

3 - define font sizes and similar attributes with the same accuracy as you have with a word processor - not being limited to just the seven different font sizes defined in HTML. - position the content of your pages with pixel precision. - redefine entire HTML tags. Say for example, if you wanted the bold tag to be red using a special font - this can be done easily with CSS

4 - define customized styles for links - such as getting rid of the underline. - define layers that can be positioned on top of each other (often used for menus that pop up).

5 Disadvantages of CSS? these will only work on version 4 browsers or newer. However, more than 95% of all browsers live up to that. - these will only work on version 4 browsers or newer. However, more than 95% of all browsers live up to that.

6 Cascading order Style will “cascade” into a new “virtual” style sheet by the following rules, where number 4 has the highest priority 1.Browser default 2.External Style Sheet 3.Internal Style Sheet (inside the tag) 4.Inline Style (inside HTML element) So, an inline style has the highest priority, which mean that it will override every style declared inside the tag, in an external style sheet, and in a browser (a default value)

7 CSS syntax The syntax is made up of three parts:The syntax is made up of three parts: a selectora selector normally the element/tag you wish to define a propertya property the attribute you wish to change a valuea value each property can take a value The property and value are separated by a colon and surrounded by curly bracesThe property and value are separated by a colon and surrounded by curly braces selector { property : value } body { color : black }

8 CSS syntax If the value is multiple words, put quotes around the valueIf the value is multiple words, put quotes around the value If you wish to specify more than one property, you should separate each property with semi-colon.If you wish to specify more than one property, you should separate each property with semi-colon. The example below shows how to define a center aligned paragraph, with a red text colorThe example below shows how to define a center aligned paragraph, with a red text color p { font-family : “sans serif” } p { text-align : center ; color : red }

9 Grouping You can group selectorsYou can group selectors Each selector need to be separate with a commaEach selector need to be separate with a comma The example below have grouped all the header elements. Each header element will be greenThe example below have grouped all the header elements. Each header element will be green h1, h2, h3, h4, h5, h6 { color: green }

10 The class attribute With the class attribute you can define different styles for the same elementWith the class attribute you can define different styles for the same element Example below show how to set a 2 types of different paragraphExample below show how to set a 2 types of different paragraph p.right {text-align: right} p.center {text-align: center} You have to use the class attribute in your HTML documentYou have to use the class attribute in your HTML document This paragraph will be right-aligned This paragraph will be right-aligned This paragraph will be center-aligned This paragraph will be center-aligned

11 The class attribute You can also omit the tag name in the selector to define a style that can be used by many elementsYou can also omit the tag name in the selector to define a style that can be used by many elements eg..center {text-align: center}eg..center {text-align: center} To use the style we can look at the example belowTo use the style we can look at the example below This heading will be center-aligned This heading will be center-aligned This paragraph will also be center- aligned This paragraph will also be center- aligned

12 CSS comments You can insert comments in CSS to explain your code, which can help you when you edit the source code at a later date A comment will be ignored by the browser CSS comment begin with /* and end with */ eg/* This is a comment */

13 How to insert a Style Sheet There are 3 ways of inserting a style sheet External Style Sheet Internal Style Sheet Inline Style Sheet

14 External Style Sheet An external style sheet is ideal when the style is applied to many pages With an external style sheet, you can change the look of an entire web site by changing one file Each page must link to the style sheet using the tag The tag goes inside the head section

15 External Style Sheet The browser will read the style definitions from the file mystyle.css, and format the document according to it An external style sheet can be written in any text editor The file should not contain any html tags Your style sheet should be saved with a.css extension An example of a style sheet file is shown below hr { color: sienna } p { margin-left: 20px } body { background-image: url(“images/back40.gif”) }

16 Internal Style Sheet An internal style sheet should be used when a single document has a unique style You define internal styles in the head section by using the tag hr { color: sienna } p { margin-left: 20px } body {background-image: url(“images/back40.gif) }

17 Inline Styles An inline style loses many of the advantages of style sheets by mixing content with presentation Use this method sparingly, such as when a style is to be applied to a single occurrence of an element. To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a paragraph: This is a paragraph

18 CSS Background Properties The background properties allow you to control the background color of an element set an image as the background repeat a background image vertically or horizontally position an image on a page Example of background properties Example of background properties

19 CSS Text Properties Text properties allow you to control the appearance of text It is possible to change the color of a text, increase or decrease the space between characters in a text, align a text, decorate a text, indent the first line in a text, and more more Example of text properties Example of text properties

20 CSS Font Properties The Font properties allow you to change the font family, boldness, size, and the style of a text Example of font properties Example of font properties

21 CSS Border Properties The Border properties allow you to specify the style, color, and width of an element's border In HTML we used tables to create borders around a text, but with the Border properties we can create borders with nice effects, and it can be applied to any element Example of border properties Example of border properties

22 CSS Margin Properties The Margin properties define the space around elements It is possible to use negative values to overlap content The top, right, bottom, and left margin can be changed independently using separate properties A shorthand margin property can also be used to change all of the margins at once Example of margin properties Example of margin properties

23 CSS Padding Properties The Padding properties define the space between the element border and the element content Negative values are not allowed The top, right, bottom, and left padding can be changed independently using separate properties A shorthand padding property is also created to control multiple sides at once Example of padding properties Example of padding properties

24 CSS List Properties The List properties allow you to change between different list- item markers, set an image as a list-item marker, and set where to place a list-item marker Example of unordered lists Example of unordered lists Example of ordered list Example of ordered list