INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.

Slides:



Advertisements
Similar presentations
Web Engineering 1 Ishaq Khan Shinwari MCS City University Peshawar.
Advertisements

Client-Side Internet and Web Programming
Measurement Many CSS properties (values within the declaration) require that you specify a unit of measurement, such as spacing between elements, border.
Cascading Style Sheets Color and Background Controls Border and Margin Controls (Boxes)
Session Objectives Setting the font family Setting the font size Working with Web fonts Setting font faces and sizes Setting font and text appearances.
Week 9 Using the Box Properties. 9-2 The CSS Visual Formatting Model Describes how the element content boxes should be displayed by the browser –Based.
CIS 1310 – HTML & CSS 4 Visual Elements and Graphics.
CS4370/6370 Web Development Cascading Style Sheets (CSS)
CASCADING STYLE SHEETS CSS. 2 What CSS means?  CSS is an extension to basic HTML that allows you to style your web pages.  It separates the part that.
Week 7 Web Typography. 2 Understanding Type Design Principles.
Basics of Web Design Chapter 6 More CSS Basics Key Concepts 1.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
Web Design & Development Cascading Style Sheets (CSS)
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Style sheets can also affect the BODY. style4.css BODY {BACKGROUND-COLOR : white} H1 {COLOR : red; FONT-SIZE : 50; FONT-FAMILY : arial} H2 {COLOR : green}
Style sheets can also affect the body. style4.css body {background-color : white} h1 {color : red; font-size : 50; font-family : arial} h2 {color : green}
Lecture CSS: Cascading Style Sheets. What are Styles? Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation semantics.
3.1 Cascading Style Sheets. Motto Fashions fade, style is eternal. —Yves Saint Laurent.
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.
CSS1-1 Cascading Style Sheets (CSS) Xingquan (Hill) Zhu
CSS Dvijesh Bhatt.
CSS Typography, Fonts, Spacing, Borders, Backgrounds, Opacity
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
Cascading Style Sheets, pt 2 ECA 225 Applied Online Programming.
Cascading Style Sheets CSS. CSS - Structure Declaration block Property: identifies what to change Value: how to change it Selector – example h1{ font-size:
WORKING WITH CASCADING
New Perspectives on XML, 2nd Edition Tutorial 5 1 TUTORIAL 5 WORKING WITH CASCADING STYLE SHEETS.
XP New Perspectives on XML Tutorial 5 1 TUTORIAL 5 CSS Tutorial – Carey ISBN
Chapter 12 Cascading Style Sheets: Part II The Web Warrior Guide to Web Design Technologies.
(CSS) More Details Instructor: Mr. Ahmed Al Astal ITGD4104 Department Requirement for senior student University of Palestine Faculty of IT.
CSS Border.
Cascading Style Sheets Chapter Four. What are they? A set of style rules that tell the web browser how to present a web page or document. Cascading Style.
Class three: CSS review, backgrounds, font formatting, the box model.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
CHAPTER 3 CSS & CSS3 อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
COMP213 – Web Interface Design
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.
Basics of Web Design Chapter 6 More CSS Basics Key Concepts.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
INTRODUCTORY Tutorial 4 Exploring Graphic Elements and Images.
Creating Your Own Webpage COSC Cascading Stylesheets Think of: HTML: content of your webpage HTML has tags CSS: presentation and appearance of your.
Cascading Style Sheets Chapters 5-6 Color and Background Controls Border and Margin Controls.
Web Foundations THURSDAY, OCTOBER 3, 2013 LECTURE 6: CSS CONTINUED.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
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.
CSS Presentation CSS Typography, Fonts, Spacing, Borders, Backgrounds, Opacity Svetlin Nakov Technical Trainer Software University
CIS234A Lecture 5 Instructor Greg D’Andrea. Font Styles Review Font-Family: generic family, font family Font-Size: em, pt, px, %, mm, cm, in Font-Style:
3.2 Cascading Style Sheets. 2 Positioning Elements Normally, elements are laid out on the page in the order that they are defined in the XHTML document.
CSS – Cascading Style Sheets
CSS properties Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
Tutorial 4 Creating Page Layouts with CSS
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
CIS234A Lecture 6 Instructor Greg D’Andrea. Span and Div The span and div elements are a generic means by which we can add structure to documents. The.
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
PERSPECTIVES: TUTORIAL 4 CREATING PAGE LAYOUTS 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.
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
1 CS428 Web Engineering Lecture 07 Font, Text & Background (CSS - II)
( Cascading style sheet )
Cascading Style Sheets (Formatting)
Cascading Style Sheets
The Internet 10/13/11 The Box Model
CSS Borders and Margins.
How to use the CSS box model for spacing, borders, and backgrounds
Cascading Style Sheets™ (CSS)
Presentation transcript:

INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE

2 Outline CSS Styling Backgrounds Text Box Model Reference: – US/docs/Web/CSS/Reference US/docs/Web/CSS/Reference

Background - Properties Background-image: – background-image:url(image.jpg); image.jpg may be a relative or absolute path background-color: can still be used, and will provide colour where the image is not displayed background-position: – Values: left top (default), right bottom, center center background-repeat: – Values: repeat (default), repeat-x, repeat-y, no-repeat background-attachment: – Values: fixed, local, scroll Shorthand property: body{ background: url("../img/seneca_logo.gif") no-repeat grey right top;} 3 Bg.html, bg.css

CSS3 Backgrounds Property “background-size”: specifies the size of the background image. Before CSS3, the background image size was determined by the actual size of the image. In CSS3 it is possible to specify the size of the background image, which allows us to re-use background images in different contexts. You can specify the size in pixels or in percentages. If you specify the size as a percentage, the size is relative to the width and height of the parent element. 4

CSS3 Backgrounds Resize a background image: 5 body { background:url(seneca_logo.gif); background-size: 80px 60px; -moz-background-size:80px 60px; /* Firefox 3.6 */ background-repeat: no-repeat; padding-top: 40px; } Bg_new.html

CSS3 Background Stretch the background image to completely fill the content area: 6 p { background:url(seneca_logo.gif); background-size: 100% 100%; -moz-background-size:100% 100%; /* Firefox 3.6 */ background-repeat: no-repeat; padding-top: 40px; Bg_new.html

background-size property Value: cover background image is scaled to be as small as possible while ensuring both its dimensions are greater than or equal to the corresponding dimensions of the background positioning area. Value: contain background image should be scaled to be as large as possible while ensuring both its dimensions are less than or equal to the corresponding dimensions of the background positioning area. 7

background-size property body { background: url('seneca_logo.gif') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; // background-size: contain; } 8 Bg_new.html

CSS3 Background Property “background-origin”: Specifies the positioning area of the background images. The background image can be placed within the content- box, padding-box, or border-box area. 9 Bg_new_origin.html

Support Browsers Firefox 3.6 and earlier does not support the background-origin property, and requires the prefix -moz- to support the background-size property. Safari 4 requires the prefix -webkit- to support the new background properties. Internet Explorer 9, Firefox 4, Chrome, Safari 5 and Opera support the new background properties. 10

Formatting Text font-family A font family or a font face is the typeface that will be applied by a web browser to some text. The font family can use a specific named font, but the actual appearance will depend on the browser and the fonts installed on the system. E.g., a default installation of I.E. always displays serif and Times as Times New Roman, and sans-serif and Helvetica as Arial. A font-family (or face in HTML) consists of a set of related fonts, grouped as font families 11

Formatting Text font-family 12 FONT p.serif{font-family: Times New Roman, Times, serif;} p.sansserif{font-family: Arial, Helvetica, sans-serif;} /* if Arial is not available, choose Helvetica, … */ p {background-color: grey;} CSS font-family This is a paragraph, shown in the Times New Roman font. this is a paragraph, shown in the Arial font. font.html,

Formatting Text font-family The web browser will only be able to apply a font if it is available on the system on which it operates, which is not always the case. So, list in preferential order font families to use when rendering text. The font list is separated by commas. To avoid unexpected results, the last font family on the font list should be one of the five generic families which are by default always available in HTML and CSS. 13

Generic Font Family 14

Generic Font 15

Generic Font (Cont’d) 16

Formatting Text font-size Font size for different elements h1 {font-size:250%} –size relative to regular size (scales well) p {font-size: 20pt} –actual size in points, div{font-size:20px} –actual size in pixels, {font-size: smaller} – smaller than regular size, default medium {font-size: 1.5em} – size relative to regular size (scales well) 17

Font-size: Property values 18

Units in CSS em: The "em" is a scalable unit that is used in web document media. 1 em = the current font-size, e.g., 12pt Ems are scalable in nature, so 2em = 24pt, Ems are becoming increasingly popular in web documents due to scalability and their mobile-device-friendly nature. em stands for "M", the letter M being the widest character in a font. 19

Units in CSS px: Pixels are fixed-size units that are used in screen media. One pixel = one dot on the computer screen (the smallest division of your screen's resolution). It does not scale upward for visually-impaired readers or downward to fit mobile devices. 20

Units in CSS pt: Points are traditionally used in print media One point = 1/72 of an inch. Points are fixed-size units and cannot scale in size. 21

Units in CSS %: The percent unit is much like the "em" unit. Current font-size = 100% (i.e. 12pt = 100%). While using the percent unit, the text remains fully scalable for mobile devices and for accessibility. 1 em = 12pt = 16px = 100% 22

Formatting Text other text properties {font-weight: bold} or “lighter”, “normal”, “bolder” {font-weight:700} or 100, 200, 300, 400(normal), 500,600, 700 (bold), 800, 900 {font-style: italic} or “normal”, “oblique” {text-align: center} – or “left” (normal), “right”, “justify” {text-indent:4em}-first-line indent, can use %, pt, px {text-indent: -4em} –hanging indent 23

Formatting Text other text properties {text-decoration: underline} or “overline”, “line-through”, “blink”, “none” {text-transform: capitalize} or “uppercase”, “lowercase”, “none” {font-variant: small-caps} or “normal” Shorthand: h2 {font:italic small-caps bolder "Lucida","Arial"; text-decoration:underline; text-align:right; color:red; background-color:silver;} 24 font-2.html

CSS3 Text Effect Text shadow: – Specify horizontal shadow, the vertical shadow, the blur distance, and the color of the shadow. h1 { text-shadow: 5px 5px 5px red; } 25 text_css3.html FeatureChrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit) Basic support (1.9.1) [1]10 [3]9.5 [2]1.1 (100) [4] Browser compatibility

CSS3 Text Effect CSS3 word wrapping If a word is too long to fit within an area, it expands outside In Css3, the word-wrap property allows to force the text to wrap Even if it means splitting it in the middle of a word. word-wrap:break-word; 26 text_css3.html Feature Firefox (Gecko) Chrome Internet Explorer OperaSafari Basic support (1.9.1) Browser compatibility

CSS Box Model All elements can be considered to be box. 27

CSS Box Model 28

CSS Margins CSS Margins define the white space around an HTML element's border. Possible values: – auto: The browser calculates a margin, center – Length: Specifies a margin in px, pt, cm, etc. Default value is 0px – %: Specifies a margin in percent of the width of the containing element 29 CSS Property Description MarginApplies to all sides Margin:autoHorizontally center the content margin:6px; /* short cut */Applies a margin to all sides of an element margin-topApplies a margin to the top of an element margin-rightApplies a margin to the right of an element margin-bottomApplies a margin to the bottom of an element margin-leftApplies a margin to the left of an element Margin.html

The margin property can have from one to four values. margin:25px 50px 75px 100px; – top margin is 25px – right margin is 50px – bottom margin is 75px – left margin is 100px margin:25px 50px 75px; – top margin is 25px – right and left margins are 50px – bottom margin is 75px margin:25px 50px; – top and bottom margins are 25px – right and left margins are 50px margin:25px; – all four margins are 25px 30

CSS Border set the color, style and width of the borders around an element. None of the border properties will have ANY effect unless the border-style property is set! Properties: 31 Border-style.html

Property border-style Values none: Defines no border dotted: Defines a dotted border dashed: Defines a dashed border solid: Defines a solid border double: Defines two borders. The width of the two borders are the same as the border-width value groove: Defines a 3D grooved border. The effect depends on the border- color value ridge: Defines a 3D ridged border. The effect depends on the border- color value inset: Defines a 3D inset border. The effect depends on the border-color value outset: Defines a 3D outset border. The effect depends on the border- color value 32

Property border-width Values The border-width property is used to set the width of the border. The width is set in pixels, or one of the three pre-defined values: thin, medium, or thick. Note: The "border-width" property does not work if it is used alone. Use the "border-style" property to set the borders first. 33

border-color set the color of the border. The color can be set by: – name - specify a color name, like "red" – RGB - specify a RGB value, like "rgb(255,0,0)" – Hex - specify a hex value, like "#ff0000" You can also set the border color to "transparent". Note: The "border-color" property does not work if it is used alone. Use the "border-style" property to set the borders first. 34 Border-color.html

Border Individual Sides Specify different borders for different sides. p { border-top-style:dotted; border-right-style:solid; border-bottom-style:dotted; border-left-style:solid; } 35

border-style:dotted solid double dashed; – top border is dotted – right border is solid – bottom border is double – left border is dashed border-style:dotted solid double; – top border is dotted – right and left borders are solid – bottom border is double border-style:dotted solid; – top and bottom borders are dotted – right and left borders are solid border-style:dotted; – all four borders are dotted It also works with border-width and border-color. 36 The border-style property can have from one to four values.

Border Shorthand property shorthand property: specify all the individual border properties in one property. The border property is a shorthand for the following individual border properties: – border-width – border-style (required) – border-color border:5px solid red; 37 Border-short.html

CSS3 Rounded Corners Property: border-radius 38 div { border:2px solid #a1a1a1; padding:10px 40px; background:grey; width:300px; border-radius:25px; -moz-border-radius:25px; /* Firefox 3.6 and earlier */ } Border_css3.html

CSS3 Rounded Corners 39 border-radius:2em; is equivalent to: border-top-left-radius:2em; border-top-right-radius:2em; border-bottom-right-radius:2em; border-bottom-left-radius:2em; The border-radius property is supported in IE9+, Firefox 4+, Chrome, Safari 5+, and Opera.

CSS3 Box Shadow Property: box-shadow box-shadow: h-shadow v-shadow blur spread color inset; 40 -moz-box-shadow: 10px 10px 5px #888888; /* Firefox 3.6 and earlier */ box-shadow: 10px 10px 5px blue; Border_css3.html

CSS3 Box Shadow box-shadow: h-shadow v-shadow blur spread color inset;

Padding Property- "padding“: defines the space between the element border and the element content. {padding:5px} - pads by 5 pixels on top, right, bottom, left. {padding:5px 10px} - pads by 5 on top & bottom, 10 on right & left {padding:5px 10px 15px} - pads by 5 on top, 10 on right, 15 on bottom, 10 on left (assumes same as right) {padding:5px 10px 15px 20px} - pads by 5 on top, 10 on right, 15 on bottom, 20 on left using styles for padding articles, article headings, and horizontal rules. 42 Padding.html

Web Colors  CSS colors are specified in 3 formats:  Hexadecimal Value Notation  Hex triplet: written as 3 double digit numbers, starting with a # sign.  e.g. h1 { background-color: #800080; }  RGB Value Notation  the combination of Red, Green, and Blue color values (RGB).  e.g. P { color: rgb(128,0,128); }  Named colors, e.g., P { color: red; } 43

44 Color (Named)Color HEXColor RGB Black#000000rgb(0,0,0) Red#FF0000rgb(255,0,0) Green#00FF00rgb(0,255,0) Blue#0000FFrgb(0,0,255) Yellow#FFFF00rgb(255,255,0) Aqua#00FFFFrgb(0,255,255) Fuchsia #FF00FFrgb(255,0,255) Gray#808080rgb(128, 128, 128) Silver#C0C0C0rgb(192,192,192) White#FFFFFFrgb(255,255,255) Color Format

Next Class More CSS 45

Thank you!