3. Cascading Style Sheets (CSS) M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer.

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. 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.
Web Engineering 1 Ishaq Khan Shinwari MCS City University Peshawar.
Cascading Style Sheets
Cascading Style Sheets
Introduction to CSS. What is CSS? A CSS (cascading style sheet) file allows you to separate your web sites (X)HTML content from it’s style. Use your (X)HTML.
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(Cascading Style Sheets )
กระบวนวิชา 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.
Chapter 8 Creating Style Sheets.
XP Introducing Cascading Style Sheets With Cascading Style Sheets (CSS), you can create one or more documents that control the appearance of some or all.
CSE CASCADING STYLE SHEETS CSS Faculty of Computer Science and Engineering.
Cascading Style Sheet (CSS) Instructor: Dr. Fang (Daisy) Tang
4.01 Cascading Style Sheets
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.
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.
Using Cascading Style Sheets. Introduction to Styles and Properties  Cascading Style Sheets (CSS) are a standard set by the World Wide Web Consortium.
CSS Dvijesh Bhatt.
Cascading style sheets (CSS)
Week 4.  Three ways to apply CSS: Inline CSS Internal style sheets ( header style information) External style sheets.
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
New Perspectives on XML, 2nd Edition Tutorial 5 1 TUTORIAL 5 WORKING WITH CASCADING STYLE SHEETS.
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.
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.
Cascading Style Sheets Orientation Learning Web Design: Chapter 11.
CSS CSS is short for C ascading S tyle S heets. It is a new web page layout method that has been added to HTML to give web developers more control over.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
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.
Lesson 03 // Cascading Style Sheets. CSS Stands for Cascading Style Sheets. We’ll be using a combination of Html and CSS to create websites. CSS is a.
Creating Your Own Webpage COSC Cascading Stylesheets Think of: HTML: content of your webpage HTML has tags CSS: presentation and appearance of your.
Advanced Web Development Instructor: Thomas Bombach.
DIV, Span, CSS.
Course created by Sarah Phillips BBCD Melbourne BAPDCOM Version 1 – April 2013.
HTML GUIDE Press F5 and then Click on the links on the left to get to the section you want Section 1: Getting Started Section 2: Moving Banner Section.
Cascading Style Sheets CSS. Source W3Schools
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.
Introduction to CSS. Why CSS? CSS Provides Efficiency in Design and Updates CSS relatively easy to use Can give you more flexibility and control Faster.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations Slide Set #4: CSS.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
1 CSS محمد احمدی نیا 2 Of 21 What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements 
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.
Creating Layouts with CSS. Span tag Here is some underlined text. Here is some blinking text. Here's some bold text.
Tutorial 3 Designing a Web Page with CSS
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.
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.
CONFIGURING COLOR AND TEXT WITH CSS Chapter 3. Cascading Style Sheets (CSS) Used to configure text, color, and page layout. Launched in 1996 Developed.
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
Creating Your Own Webpage
Madam Hazwani binti Rahmat
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Cascading Style Sheets - Building a stylesheet
What are Cascading Stylesheets (CSS)?
Training & Development
Cascading Style Sheets - Building a stylesheet
4.01 Cascading Style Sheets
Web Programming and Design
Introduction to Cascading Style Sheets (CSS)
Presentation transcript:

3. Cascading Style Sheets (CSS) M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer (C-307) Desain dan Pemrograman Web

Table of Contents Introduction to CSS Styles Solved a Big Problem CSS Saves a Lot of Work Inline Styles Internal Stylesheet External Stylesheet CSS Classes CSS ID CSS Divisions CSS Spans CSS Margins CSS Padding CSS Text Properties CSS Font Properties CSS Anchors and Links CSS Borders CSS Lists CSS Table

Introduction to CSS CSS stands for Cascading Style Sheets A style sheet is made up of style rules that tell a browser how to present a document. External Style Sheets are stored in CSS files. This element is placed in the document HEAD, and it contains the style rules for the page.

Styles Solved a Big Problem 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 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.

CSS Saves a Lot of Work CSS defines HOW HTML elements are to be displayed. Styles are normally saved in external.css files. External style sheets enable you to change the appearance and layout of all the pages in a Web site, just by editing one single file.

A CSS (cascading style sheet) file allows you to separate your web sites (X)HTML content from it's style. As always you use your (X)HTML file to arrange the content, but all of the presentation (fonts, colors, background, borders, text formatting, link effects & so on...) are accomplished within a CSS. How to use the CSS:  Inline Style (inside (X)HTML element).  Internal Style Sheet (inside the tag)  External Style Sheet.

Inline Styles Inline styles are defined right in the (X)HTML file along side the element you want to style. See example below.

Internal Stylesheet This way you are simply placing the CSS code within the tags of each (X)HTML file you want to style with the CSS. With this method each (X)HTML file contains the CSS code needed to style the page. Meaning that any changes you want to make to one page, will have to be made to all. This method can be good if you need to style only one page, or if you want different pages to have varying styles.

External Stylesheet A CSS file contains no (X)HTML, only CSS. You simply save it with the.css file extension. You can link to the file externally by placing one of the following links in the head section of every (X)HTML file you want to style with the CSS file. Or you can also use method:

Either of these methods are achieved by placing one or the other in the head section as shown in example below. url(Path To stylesheet.css)

By using an external style sheet, all of your (X)HTML files link to one CSS file in order to style the pages. This means, that if you need to alter the design of all your pages, you only need to edit one.css file to make global changes to your entire website. Here are a few reasons this is better.  Easier Maintenance  Reduced File Size  Reduced Bandwidth  Improved Flexibility

CSS Syntax Consists of only 3 parts. The selector is the (X)HTML element that you want to style. The property is the actual property title, and the value is the style you apply to that property.

Each selector can have multiple properties, and each property within that selector can have independent values. The property and value are separated with a colon and contained within curly brackets. Multiple properties are separated by a semi colon. Multiple values within a property are sperated by commas, and if an individual value contains more than one word you surround it with quotation marks.

Inheritance When you nest one element inside another, the nested element will inherit the properties assigned to the containing element. Unless you modify the inner elements values independently. If you wanted to style certain text with another font, like an h1 or a paragraph then you could do the following.

Combining Selectors Comment tags

CSS Classes The class selector allows you to style items within the same (X)HTML element differently. Example: I wanted to change the word “sentence” to green bold text, while leaving the rest of the sentence untouched.

Then in my CSS file you would add this style selector: The final result would look like the following: “To put it more simply, this sentence you are reading is styled in my CSS file by the following.” Please note that a class selector begins with a (.) period.

CSS ID IDs are similar to classes, except once a specific id has been declared it cannot be used again within the same (X)HTML file. I generally use IDs to style the layout elements of a page that will only be needed once, whereas I use classes to style text and such that may be declared multiple times.

In CSS file: In the main of page An id selector begins with a (#) sign, while the class selector begins with a (.) sign.

CSS Divisions Divisions are a block level (X)HTML element used to define sections of an (X)HTML file. A division can contain all the parts that make up your website. Including additional divisions, spans, images, text and so on. You define a division within an (X)HTML file by placing the following between the tags:

The CSS file contains: You can use both classes and IDs with a division tag to style sections of your website.

CSS Spans Spans are very similar to divisions except they are an inline element versus a block level element. No linebreak is created when a span is declared. You can use the span tag to style certain areas of text, as shown in the following: In CSS file:

CSS Margins The margin property declares the margin between an (X)HTML element and the elements around it. The margin property can be set for the top, left, right and bottom of an element.

CSS Padding Padding is the distance between the border of an (X)HTML element and the content within it.

CSS Text Properties Color You can set the color of text with the following: Possible values are  color name – example:(red, black…)  hexadecimal number – example:(#ff0000, #000000)  RGB color code – example:(rgb(255, 0, 0), rgb(0, 0, 0))

Letter Spacing. You can adjust the space between letters in the following manner. Setting the value to 0, prevents the text from justifying. Possible values are: normal, length. Text Align Possible values are left, right, center, justify. Text Decoration Possible values are: none, underline, overline, line through, blink.

Text Transform Possible values are: none, capitalize, lowercase, uppercase. Word Spacing You can adjust the space between words in the following manner. Possible values are: normal, length.

CSS Font Properties font: italic bold normal small/1.4em Verdana, sans-serif; font-family: Verdana, sans-serif; font-size: value; Possible values: large, medium, small, etc. font-style: value; Possible values: normal, italic, oblique. font-variant: value; Possible values: normal, small-caps. font-weight: value; Possible values: lighter, normal, 100, 200,etc.

CSS Anchors and Links

CSS Borders You can set the color, style and width of the borders around an element in one declaration by using the border property. Example:  border: 1px solid #333333;  border-color: value;  border-style: value; [dashed, dotted, etc].  border-width: value; [Length, thin, medium, etc].  border-bottom: 1px solid #333333;  border-left: 1px solid #333333;  border-left-color: value;  Etc.

CSS Lists You can control the appearance of ordered and unordered lists in one declaration with the list-style property. list-style: value value; Values: image, position, type. list-style-image: url(path_to_image.gif, jpg or png); list-style-position: value; Values: inside, outside. list-style-type: value; Values: disc, circle, square.

CSS Table To specify table borders in CSS, use the border property. Example: table, th, td { border: 1px solid black; }

References - Credit Christopher Schmitt, “CSS Cookbook”. Simon Collison, Andy Budd, Cameron, “CSS Mastery: Advanced Web Standards Solutions”.

Finish