CASCADING STYLE SHEETS (CSS) BY: RIHAM ALSMARI, PNU. Lab 4

Similar documents
CSS: The Basics CISC 282 September 20, 2014

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations

Appendix D CSS Properties and Values

Three Ways to Use CSS:

The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations).

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style

By completing this practical, the students will learn how to accomplish the following tasks:

8a. Cascading Style Sheet

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets

Tutorial 3: Working with Cascading Style Sheets

Fundamentals of Web Programming a

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values

Introduction to Web Design CSS Reference

Introduction to Web Design CSS Reference

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2)

Introduction to Web Tech and Programming

Multimedia for the Web: Creating Digital Excitement. Multimedia Element Text

Web Development & Design Foundations with HTML5, 8 th Edition Instructor Materials Chapter 3 Test Bank

Web Design and Development ACS-1809

COSC 2206 Internet Tools. CSS Cascading Style Sheets

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

Review Question 1. Which tag is used to create a link to another page? 1. <p> 2. <li> 3. <a> 4. <em>

Activity 4.1: Creating a new Cascading Style Sheet

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet.

Creating A Website - Part 1: Web Design principles, HTML & CSS. CSS Color Values. Hexadecimal Colors. RGB Color

IMY 110 Theme 6 Cascading Style Sheets

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

Assignments (4) Assessment as per Schedule (2)

Cascading Style Sheets. Overview and Basic use of CSS

ITNP43: HTML Lecture 4

INTRODUCTION TO CSS. Mohammad Jawad Kadhim

CST272 ASP.NET Style Sheets Page 1

CSS. Introduction to. Meganadha Reddy K. Technical Trainer NetCom Learning

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

DAY 4. Coding External Style Sheets

HTML/XML. HTML Continued Introduction to CSS

Web Site Design and Development Lecture 6

CSS Styles Quick Reference Guide

CSS Tutorial Part 1: Introduction: A. Adding Style to a Web Page (3 options):

Chapter 12: FORMATTING TEXT

INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations

Zen Garden. CSS Zen Garden

CSS. Text & Font Properties. Copyright DevelopIntelligence LLC

Lecture 10. CSS Properties. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

CASCADING STYLESHEETS

Faculty of Engineering Department of Computer Engineering. CSS Tutorial. Eng. Ahmed J. Alajrami

CSS Cascading Style Sheets

CASCADING STYLE SHEET CSS

ACSC 231 Internet Technologies

CSS3 Basics. From & CSS Visual Dictionary Learning Curve Books, LLC

CSc 337 LECTURE 3: CSS

Cascade Stylesheets (CSS)

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015

Advanced CSS. Abridged version of slides to accompany Internet & WWW: How To Program (1 st ed.)

CS 350 COMPUTER/HUMAN INTERACTION. Lecture 6

ID1354 Internet Applications

> > > > Cascading Style Sheets basics

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

1. Lists. 1.1 Unordered Lists. Subject Code 10CS73. Unit 2 XHTML 2, CSS. Subject Programming the Web

CSS is applied to an existing HTML web document--both working in tandem to display web pages.

CSE 154 LECTURE 3: MORE CSS

2005 WebGUI Users Conference

CSS. Lecture 16 COMPSCI 111/111G SS 2018

CITS3403 Agile Web Development 2019 Semester 1

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS

Web and Apps 1) HTML - CSS

Introduction to CSS. Fijihosting.com Introduction to CSS page 1. What are style sheets? Lovely! How do I use them?

1 of 7 11/12/2009 9:29 AM

CSS Lecture 16 COMPSCI 111/111G SS 2018

Html basics Course Outline

Introduction to CSS. Part 1: Simple Text Formatting. Source Files for this Exercise are available on the Course Website DW_CSS intro

CSS: formatting webpages

CSS مفاهیم ساختار و اصول استفاده و به کارگیری

Writing CSS is like directing a film.

CSS: Cascading Style Sheets

B3: A first introduction to CSS 17/02/2006


Comp-206 : Introduction to Software Systems Lecture 23. Alexandre Denault Computer Science McGill University Fall 2006

CS105 Course Reader Appendix A: HTML Reference

Text and Layout. Digital Multimedia, 2nd edition Nigel Chapman & Jenny Chapman Chapter 11. This presentation 2004, MacAvon Media Productions

Final Exam Study Guide

View all articles by Kevin Verdana, Tahoma, etc.) for the main body text of a site.

LBS Polytechnic. Hey! Make With The Style Sheet Already, Bub!

Chapter 4 CSS basics

CSS Selectors. element selectors. .class selectors. #id selectors

Web Development & Design Foundations with HTML5

Cascading Style Sheets (Part 3): Images and Text. Mike Hamilton V.P. Product Evangelism MadCap Software

HTML TUTORIAL ONE. Understanding What XHTML is Not

escuela técnica superior de ingeniería informática

Web Development & Design Foundations with HTML5

COMS 359: Interactive Media

Introduction to Cascading Style Sheets

Cascading Style Sheet. Styles as Tag Attributes. Syntax. <h1>: what font type/size is used? STYLE = SELECTOR {RULES} Attributes such as bgcolor

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

CS 1100: Web Development: Client Side Coding / Fall 2016 Lab 2: More HTML and CSS

Reading 2.2 Cascading Style Sheets

Controlling Appearance the Old Way

EECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling

Transcription:

1 CASCADING STYLE SHEETS (CSS) BY: RIHAM ALSMARI, PNU Lab 4

Cascading Style Sheets (CSS) 2 Three ways to apply a style to an HTML or XHTML document: Inline Styles Embedded Style Sheet External Style Sheet

1-Inline Styles 3 Inline styles are easy to use and interpret because they are applied directly to the elements they affect. <element style= style1: value1; style2: value2; style3: value3; > Example: < h1 style = text-align: center; color:red > Welcome </h1> Each CSS property is followed by a colon then the value of the attribute. Properties are separated by semicolons. The STYLE attribute allows the specification of a style property.

1-Inline Styles 4 Apply directly to the elements they affect.

2-Embedded Style Sheet (Document level style) 5 In the HEAD section of the document styles may be applied to the whole document by using the STYLE element (not attribute) The style sheet begins with <STYLE TYPE = text/css > The TYPE attribute specifies the MIME type - standard for specifying the format of content - text/html, image/gif, text/javascript

2-Embedded Style Sheet (Document level style) 6 <style type= text/css > </style> rule_list Each style rule in a rule list has two parts: a selector, which indicates the tag or tags affected by the rule, and a list of property/ value pairs. selector {style1: value1; style2: value2; style3:value3;..}

2-Embedded Style Sheet (Document level style) 7

3-External Style Sheet 8 Apply to the all Web site pages. An external style sheet is a text file that contains style declarations and it is extension.css

3-External Style Sheet 9 To apply it: (4 steps) 1- Create a new file with the.css extension. 2- Declare like the following: h1 {text-align: center; color: red} 3- You can add comments /* comments */ 4- link element to link a Web page to an external style sheet and placed it in the head section. <link href= url rel= stylesheet type= text/css /> LINK a specifies a relationship between the current document and another using the REL attribute

10

11 Selector Forms 1.Simple Selector Forms 2.Class Selectors 3.Generic Selectors 4. ID Selectors 5. Universal Selectors

1. Simple Selector Forms 12 Example 1: <style type= text/css > h1 {text-align: center; color:red} </style> Example 2: <style type= text/css > h1 {text-align: center; color:red} </style> Example 3: <style type= text/css > h2,h3 {text-align: right; color:blue} </style>

13 1. Simple Selector Forms

14 <html> <head> <title>cs 543</title> <style type="text/css"> h1 {text-align:center;color:red} ul ul {color:blue} </style> </head> <body> <h1> welcome</h1> <ul> <li>main Stick</li> <ul> <li>weight: 7 oz.</li> <li>length: 24 inches</li> <li>tape: Dura-Coat finish with laser-style color choices.</li></ul> <li>handle Sticks <q>one pair /</q></li> <ul> <li>weight: 2 oz</li> <li>length: 18 inches</li> <li>tape: Soft ivory tape with rubber core.</li></ul> </ul> </body> </html>

15 The Output :

2.Class Selectors 16 The CLASS attribute can be used to create custom styles for a set of items on a page Class Syntax: In a style element or sheet: P.myclass { color:blue;} In a body element or html page: <P CLASS= myclass >Text</P>

17 2.Class Selectors

18 3.Generic Selectors

4. ID Selectors 19 1- Use the declaration #id {style rule} Example : #subtitle {color:red} 2-Apply to that specific element <h2 id = subtitle >Welcome </h2>

20 4. ID Selectors

21 5. Universal Selectors

Defining Text and Background Colors 22 Background color definition: background-color: color Text color definition: color: color where color is either the color value or the color name

Working with Fonts and Text Styles 23 In CSS, there are two types of font family names: generic family - a group of font families with a similar look (like "Serif" or "Monospace") font family - a specific font family (like "Times New Roman" or "Arial") Arial, the value sans-serif is a generic font family - used if Arial and helvetica is not found on the system.

Working with Fonts and Text Styles 24 font-size : specified in pt point also relative : xx-small, x-small, small, medium, large, x-large and xx-large. Different browsers can use different values for the relative font sizes. For example : small might mean 10 points on one browser and 8 points on another.

25 Working with Fonts and Text Styles

Working with Fonts and Text Styles 26 The font-style property is mostly used to specify italic text. This property has three values: normal - The text is shown normally italic - The text is shown in italics oblique - The text is "leaning" (oblique is very similar to italic, but less supported)

27

Working with Fonts and Text Styles 28 Font-weight : The font-weight property sets how thick or thin characters in text should be displayed. The default value is normal. The values is: Normal. Lighter. Bold. Bolder. font-weight : value;

29 Working with Fonts and Text Styles

Working with Fonts and Text Styles 30 Text-decoration: text-decoration: type Where type is underline, overline, line-through, or none. p { text-decoration:underline}

31 Working with Fonts and Text Styles

Setting the Image Size 32 By default, browsers display an image at its saved size You can specify a different size by adding the HTML attributes width="value" height="value"

Formatting Backgrounds 33 The syntax for inserting a background image is: background-image: url(url) URL is the location and filename of the graphic file you want to use for the background of the Web page

34

Background Image Options 35 By default, background images are tiled both horizontally and vertically until the entire background of the element is filled up You can specify the direction of the tiling using the style: background-repeat: type

36 Background Image Options

37 Background Image Options

38 Background Image Options

39 The Background Style You can combine the various background styles into the following single style: Possible Values scroll (default) - the background image will scroll with the rest of the content. fixed - the background image will remain stationary as the rest of the content is scrolled. Example body {background-image: url(wallpaper.jpg); background-repeat: no-repeat; background-attachment: fixed}

Background Position 40 The background-position property sets the starting position of a background image. Property Values left top left center left bottom right top right center right bottom center top center center center bottom If you only specify one keyword, the other value will be "center"

Background Position 41 body {background-image: url(wallpaper.jpg); background-repeat: repeat-y; background-attachment: fixed; background-position:right }

42 Background Position

43 THE END Lab 4