HTML 5 AND CSS Dr Mohd Soperi Mohd Zahid Semester 2 2015/16.

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

Today CSS HTML A project.
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.
Cascading Style Sheets Basics. Why use Cascading Style Sheets? Allows you to set up a series of rules for all pages in a site. The series may be changed.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
กระบวนวิชา 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.
9-May-15 More CSS. 2 A different emphasis CSS is the same for XML as it is for HTML and XHTML, but-- XML contains no display information If you want your.
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.
Tutorial 5 Working with the Box Model. XP Objectives Understand the box model Create padding, margins, and borders Wrap text around an image Float a block-level.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic CSS: Cascading Style Sheets.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Tutorial 4 Creating Special Effects with CSS
4.01 Cascading Style Sheets
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
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.
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
XP Tutorial 7New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks.
CSS Dvijesh Bhatt.
Cascading style sheets (CSS)
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
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
Tutorial 4 Creating Special Effects with CSS
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
CSS – Presentation of Information. Types of Style Sheets External Embedded h1{color:red; font-family: Arial;} Inline Text is here.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
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.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
Chapter 6 Introducing Cascading Style Sheets Principles of Web Design, 4 th Edition.
ECA225 Applied Interactive Programming Cascading Style Sheets, pt 1 ECA 225 Applied Online Programming.
>> The “Box” Model. Pre-requisite Create a new project in Netbeans called Week5 Create a new html file and name it box.html Create a new css file and.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Course created by Sarah Phillips BBCD Melbourne BAPDCOM Version 1 – April 2013.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
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.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
Tutorial 4 Creating Special Effects with CSS. New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition 2 Objectives Work with CSS selectors.
Tutorial 4 Creating Special Effects with CSS. XP Objectives Work with CSS selectors Create styles for lists Create and apply class styles Create a rollover.
CSS: Cascading Style Sheets Part II. Style Syntax.
CIS 228 The Internet 10/18/11 Grouping XHTML. CSS Selectors Rule: selector-group { property-declaration* } Selector-group: selector *, Selector: simple-selector.
Tutorial #5 Working with the Box Model. Tutorial #4 Review - CSS Create a homework page Final Project Discussion Exam on Blackboard Styling Lists (List-style-type,
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
Chapter 6 Introducing Cascading Style Sheets Principles of Web Design, Third Edition.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
Web Design Principles 5 th Edition Chapter 3 Writing HTML for the Modern Web.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
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.
Working with Cascading Style Sheets
4.01 Cascading Style Sheets
CSS: Cascading Style Sheets
6 Layout.
4.01 Cascading Style Sheets
Presentation transcript:

HTML 5 AND CSS Dr Mohd Soperi Mohd Zahid Semester /16

Origins of Markup Languages First HTML (a simplified application of the Standard Generalized Markup Language – SGML) created by Tim Berners-Lee in 1989 at Physics Particle Lab, Cern SGML HTML4 XML XHTML Origins of Markup Languages HTML5

History of HTML

Two Allowed Syntaxes in HTML5 Stricter HTML5 should used in a professional web development environment

New HTML5 elements

New elements to structure page

Adding presentation information

What is CSS Cascading Style Sheets (CSS) is a style language that can be used to display web pages for different devices (smartphone, tablet, or computer screen), lay out page designs, and control typography, color, and many other presentation characteristics CSS separates presentation properties from content of web page CSS contains style rules which express the style characteristics for some HTML elements Style rules can be embedded in HTML document or placed in an external style sheet and then linked to web pages

A simple CSS example

CSS Syntax A style rule has two parts: a selector and a declaration The selector determines the element to which the rule is applied The declaration consists of property:value pair that tells the browser how to display the element Example:p {color: blue;} The selector is the element The declaration is color: blue, which is a rule to be applied when the paragraph is displayed The property and value of the declaration are color and blue respectively

What’s new in HTML5 All display information should be specified with CSS, not in attribute of elements – so fewer attributes needed (e.g. size, color, alignment of text should not be specified in attribute of the element anymore) Some elements have been removed such as,, New elements to describe structure or layout of page is created. No need to use element to structure a page A standard way to embed audio or video stream into a web page using and elements – without using third-part software (QuickTime or Flash)

Validating your code HTML or XHTML code should be validated to make sure it conforms to W3C standard To validate your code, use built-in validators available in some HTML editors, or use a web-based validator such as the W3C validation service at

CSS There are three ways to combine CSS rules with HTML code: 1) Inline style, 2) Internal style sheet, and 3) External style sheet

CSS External style sheet can be applied across multiple pages within the web site. To link an external stylesheet add in element, Internal style sheet affects only the document in which it is contained. Add the element. In older HTML, it needs the type attribute:, but not anymore in HTML5 Inline style affects only a specific element. It overrides a style that was set at a higher level Comments are allowed in element which begin with /* and end with */

Activity 2 Use internal style sheet to convert the web page as shown

CSS property inheritance By default, most CSS properties of child elements inherit from parent elements – inheritance. If a rule is specified for element in HTML code shown, element inherits the style rule unless another rule is specified for h1 {color: red;} p {color: red;} ul {color: red;} em {color: red;} li <color: red;} body {color: red;} simpler

Basic CSS Selection techniques Type selectors Grouping selector Combining declarations Descendant selectors p { color: blue; font-size: 125%; } h1 {color:red;} h2 {color:red;} h1, h2 {color:red;} body {color: gray;} h2 {color: red;} p {font-size: 85%;} p em {color:blue;} ul li em {color:blue;} p {color: blue;} p {font-size: 125%;}

Activity 3 Add Internal CSS style rules to HTML code of web page shown on the left to get the web page shown on the right

More CSS Selection Techniques The class selector – uses style rule with dot (.) followed by a name of class attribute in the selector The id selector – uses a pound sign (#) followed by a name of id attribute in the selector The and elements – uses div or span combined with # and id or dot and class name in the selector The pseudo-class and pseudo-element selectors Note: is block-level element, is in-line level element

Activity 4 (Basic CSS Selection) Download Activity4-nonCSS.html from elearning. Modify the code using CSS to display the following page:

Activity 5 (using div and span) Download Activity5-nonCSS.html from elearning. Modify the code using CSS to display the following page:

Pseudo-Class and Pseudo-Element Pseudo-class – for selecting elements based on characteristics other than their element name (e.g. change the color of a new or visited hypertext link) Pseudo-element – for changing other aspects of a document that are not classified by elements (e.g. apply style rules to the first letter or first line of a paragraph)

Activity 6 Download Activity6-nonCSS.html from elearning. Modify the code using CSS to display the following page:

CSS Measurement Units

p and blockquote with text-indent

vertical-align, text-align

Activity 7 Download Activity6-nonCSS.html from elearning. Modify the code using CSS to display the following page:

text-decoration and text-shadow horizontal, vertical offset, blur amount, color of shadow a {text-decoration: none}

CSS Box types Elements in HTML fall into two primary box types: Block or Inline Block-level boxes – appear as blocks such as paragraphs which can contain other block elements or inline boxes with element content Inline-level boxes – contain the content within the block- level elements

CSS Visual Formatting Model

Display type of box By default, elements are displayed either as block-level or inline elements

CSS Box Model Each block-level element is displayed as a box with content. Each content box can have margins, borders, and padding

Using CSS Box model

Syntax of margin property

Padding property

border-style property values None Dotted Dashed Solid Double Groove Ridge Inset outset

border-radius property The style rule for header: All boxes use:

Properties for page layout box width, min-width, max-width height, min-height, max-height float clear overflow div {width: 200px;}

Using float property

Using overflow property Use overflow property to handle situations when content overflows its content box

Normal flow of elements Boxes are laid out vertically one after the other, beginning at the top of the containing block. Each box horizontally fills the browser window. Elements do not appear next to each other unless they are floated or have a display type of inline

Web page with multiple elements With HTML5, the element can now oftenly be avoided in creating a page layout because new elements such as and are available

and elements Both can be used to contain content, can be interchangeably nested within each other (articles can contain sections and vice versa) represents a thematically grouped section of a document, and should contain a heading element to describe its content (e.g. a chapter of a book) also contains a themed group of content, but it is different from. Examples are forum post, a magazine or newspaper article, a blog entry, a user- submitted comment, or any other independent item of content

Using and

A page layout

Page Layout Example

Using clear property

Floating elements within a float

Creating a flexible layout nav { width: 15%; height: 500px; float: left; border: solid thin black; background-color: #fabf8f;}