XHTML and CSS Introduction to XHTML and CSS Bharti Patel 1 phones off (please)

Slides:



Advertisements
Similar presentations
Introduction to HTML & CSS
Advertisements

Intro To Cascading Style Sheets By Mario Yannakakis.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Ideas to Layout Beginning web layout using Cascading Style Sheets (CSS). Basic ideas, practices, tools and resources for designing a tableless web site.
Cascading Style Sheets
Cascading Style Sheets (CSS) “Styles” for short. Pg. 418.
Cascading Style Sheets
Today CSS HTML A project.
HTML Overview - Cascading Style Sheets (CSS). Before We Begin Make a copy of one of your HTML file you have previously created Make a copy of one of your.
HTML – A Brief introduction Title of page This is my first homepage. This text is bold  The first tag in your HTML document is. This tag tells your browser.
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.
Introduction to Cascading Style Sheets (CSS) Module 2: HTML Basics LESSON 4.
Cascading Style Sheets. Slide 2 Lecture Overview Overview of Cascading Style Sheets (CSS) Ways to declare a CSS CSS formatting capabilities New features.
1 Getting Started with CSS. 2 CSS Cascading Style Sheets XHTML provides structure for our documents (web pages) CSS provides Style or Presentation for.
Using Cascading Style Sheets CSS Structure. Goals Understand how contextual, class and ID selectors work Understand how contextual, class and ID selectors.
XHTML and CSS Overview. Hypertext Markup Language A set of markup tags and associated syntax rules Unlike a programming language, you cannot describe.
More HTML Chapter 4. 2 Nesting Tags How do you write the following in HTML? The wrong way: This is really, REALLY fun ! Tags must be correctly nested.
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.
© 2007 D. J. Foreman CSS-1 Cascading Style Sheets Styles.
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.
HIGHER COMPUTING CSS. WHAT IS CSS? CSS: Cascaded Style Sheets used to separate a web site’s content(information) from its style(how it looks).
TECH2018 Multimedia and the Internet More about CSS and Page Layouts.
1 Working with Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size,
Chapter 4 Cascading Style Sheets Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Chapter 11 Cascading Style Sheets: Part I The Web Warrior Guide to Web Design Technologies.
Cascading Style Sheets (CSS) 1.  What is CSS?  Why CSS?  How to write a CSS? 2.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Cascading Style Sheet (CSS)
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
HTML (HyperText Markup Language)
 HTML stands for Hyper Text Mark-up Language. The coding language used to create documents for the World Wide Web  HTML is composed of tags. HTML tags.
I NTRO TO CSS IAT100 Spring I NTRO TO CSS Covered in this lesson: Overview What is CSS? Why to use CSS? CSS for Skinning your Website Structure.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Using Cascading Style Sheet As you create more web pages, you may wish to impose a consistent look for all of your web pages or for group of related pages.
XHTML/CSS Week 3. This Week  Quiz to revise last week (XHTML and DW)  CSS - Part 2  Using HTML Tables.
Cascading Style Sheets Orientation Learning Web Design: Chapter 11.
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.
Tutorial 5 Formatting with CSS. Objectives Session 5.1 – Evaluate why CSS styles are used – Determine where to write styles – Create an element selector.
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.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 7.
CSS Cascading Style Sheets. CSS Advantages Greater typography and page layout control Style is separate from structure Styles can be stored in a separate.
Cascading Style Sheets Robin Burke ECT 270. Outline Midterm The Layout Debate CSS properties Fonts Alignment Color CSS selection selectors pseudo-classes.
1 Web Application Programming Presented by: Mehwish Shafiq.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
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.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Cascading Style Sheets (CSS). A style sheet is a document which describes the presentation semantics of a document written in a mark-up language such.
XHTML Formatting font with a style declaration. Formatting Font HTML uses the font tag to change size and family of font But… the font tag is being deprecated.
1 Working with Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size,
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
CSS Hadas Kahsay. Overview  What is CSS  Basic syntax of CSS Rules  How to link CSS style to html documents  Browsers and CSS  Advantages of CSS.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
XP 2 HTML Tutorial 1: Developing a Basic Web Page.
CSS Cascading Style Sheets *referenced from
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.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
1 Cascading Style Sheet (CSS). 2 Cascading Style Sheets (CSS)  a style defines the appearance of a document element. o E.g., font size, font color etc…
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.
Cascading Style Sheets
IS333: MULTI-TIER APPLICATION DEVELOPMENT
What are Cascading Stylesheets (CSS)?
Understand basic HTML and CSS terminology, concepts, and basic operations. Objective 3.01.
Presentation transcript:

XHTML and CSS Introduction to XHTML and CSS Bharti Patel 1 phones off (please)

Definition of a webpage Xhtml page structure Elements id and class attributes Style Sheets Cascading Style Sheets Inline, internal and external style sheets Style rules Overview

What is a Web Page? A web page is a simple text file could be written in Notepad we use JPadPro The text is structured using markup (xhtml) markup simply means adding annotati on xhtml markup comprises elements there is a set of elements that we can use The elements represent common features for structure and appearance These include paragraphs, images, headings The page’s appearance is set in a CSS Cascading Style Sheet XML) HyperText Markup Language

What is a Web Page? Browsers (Internet Explorer, Firefox, Crome) interpret the xhtml markup with the CSS in order to determine how to display the content The xhtml has a strict syntax / grammar The xhtml must be correct The xhtml can be validated CSS has a strict syntax / grammar The CSS must be correct The CSS can be validated

What is a Web Page Text with coded messages telling a browser what to display. Text is coded using start and an end tag The tags and content is called an element A start tag looks like An end tag looks like An element looks like text goes here

xhtml page structure html, head and body elements <html xmlns = " xml:lang = "en" lang = "en"> Title JPadPro creates a web page with this basic structure so you do not need to remember or type it in add your page content with it’s markup here

Basic Structure of a Web Page "> Title This is a division element which is usually a large section of your page..... an element looks like: text goes here the content is between the 2 tags is a start tag is an end tag a tag comprises a < (less than symbol) the tag name in lower case a > (greater than symbol) more page content with it’s markup goes here

Common Elements divisions / layers headings paragraphs lists hyperlinks media - images, videos, sound tables forms

Elements Logical elements add a logical structure to the text in the page Physical elements affect the appearance of the text

Logical Elements include Headings text goes here Paragraphs this is a paragraph – related text as in English Divisions This is a div – a chunk of other elements Spans a small piece of special text

Logical Elements include Images Hyperlinks Tables Forms multimedia objects NOT frames

Physical Elements Bold Strong Italic Headings are also physical – h1,h2 … h6 changes the size of the text

divs and paragraphs (elements) s are elements for marking up larger chunks (compare with book, chapter) s can contain aragraphs, eadings and other s aragraphs are elements for marking up a smaller chunk of connected content – as in English. aragraphs can contain s

h1)eadings and spans (elements) eadings are for marking up headings at six levels h1 (largest) to h6 (smallest) s are for marking up small chunks of particular significance eadings and s cannot contain larger chunks - div, paragraphs etc.

id and class (attributes) A page may contain many divs and paragraphs so we use attributes to name these id is an attribute used to uniquely identify elements class is an attribute used to identify a group of similar elements

divs and paragraphs (elements) id and class (attributes) Anne Other has taught mathematics and computing..... Since 1975 Anne has....

Adding XHTML Comments Comments – do not get displayed Anne Other has taught mathematics and computing..... Since 1975 Anne has....

Designing page structure Single page Simply use logic to identify the blocks use id and class as needed Multiple pages – a web site Plan shape of each page give each page an identical structure even if not every page has content in each element make id and class consistent on all pages

Cascading Style Sheets

Style Sheets Styles are used to define the appearance and layout of the page Appearance = color, font, borders etc Layout = positioning, visual structure Styles are associated with elements Styles are defined in Style Rules Style rules have a format: {property:value}

Cascading Style Seets CSS CSS are file used to contain style rules Cascading because styles cascade down Browser default are browsers style the same? External CSS (over-ride browser styles) Internal CSS (over-ride browser styles) (over-ride external CSS styles) In-line style (over-ride browser styles) (over-ride external CSS styles) (over-ride internal CSS styles)

In-line style rules use ONLY for a one-off style change style element is in the xhtml page original element one-off heading styled element one-off heading style change The style is linked to ONE element in this case a single element note 2 sets of quotes single ‘ to contain the font family name double " to contain the attribute value

Stylesheets (internal and external) Affect groups of elements When using internal and external stylesheets we associate an element with a style rule (property:value) Notation element {property:value}

Style rules Affecting a single property {property:value} e.g {text-align: right} {letter-spacing: 0.5cm} {font-family: "Comic Sans MS”} Quotes needed here because of the spaces in the font family name note the use of the colon to separate property from value

Style rule Affecting a multiple properties {property:value ;property:value; property:value} e.g {color:red;background-color:white} {font-size: 110%; text-align: right; text-transform: capitalize} Note the use of the semi-colon to separate each property setting pair Note that when setting the colour of text it is also necessary to set the background colour Note when setting multiple properties this one-per-line layout is easier to read

Styling elements element {property:value} e.g h1 {font-family: "Comic Sans MS"} This will affect ALL elements element {property:value; property:value} e.g body {color:red; background-color:white} This will affect the whole body of the page the style rule for the element the element we want to style

Internal stylesheet Use when styles apply to one page only this page h1 {font-family:"Comic Sans MS"} headings on this page

External Stylesheet Use when styles apply to many pages Define styles in separate css file save as file named:my_styles.css Contents: h1 {font-family:"Comic Sans MS"} add link in xhtml page to css file see next slide

External stylesheet – the web page use when styles apply to many pages this page <link rel = "stylesheet" type = "text/css“ href = "../css/my_styles.css" /> heading on all pages look like this

Why use external stylesheets? Content is separate from appearance. One developer does content, one appearance A stylesheet can affect all pages on a site The site has a common coherent appearance A Stylesheet can be validated In-line styles cannot be validated Multiple external stylesheets can be used One for colour, font, text One for layout – positioning

Why use internal stylesheet and inline styles? Allows style changes to be made for one page. An individual developer can customise one page OR can customise an element, class, id Can be used to try out styles quickly test via in-line copy into an internal stylesheet transfer to an external stylesheet

Colo(u)r Always set BOTH color – text background-color – background element {color:your-text-color; background-color:your-background-color}

Adding color – names and codes Color namescyan, blue, red etc (limited number) rgbvalues (0-255) or percentages Color codes #rrggbb red green blue h1 {color:cyan; background-color:blue} h1 {color:rgb(0,255,255);background-color:rgb(0%,0%,100%)} h1 {color:#00FFFF; background-color:#0000FF}

Help to choose colors

Changing Fonts  font-family cursive, sans-serif, serif  font-family Arial, “Times New Roman ", “Comic Sans MS "  font-size 10pt, 20%, 1.5em, large, smaller  font-style italic, normal  font-weight bold, bolder.. 100,500, normal  font-variantsmall-caps, normal  font: normal, cursive, small-caps,1.5em Fonts that work in all browsers

Examples /* for all text */ body {color:#FF99CC; background-color:#660099; font-family:"Comic Sans MS"} /* for a class = date */.date {color:#FFCCFF; background-color:#660099} /* for an id = heading */ #heading {color:#660099; background-color:#CC99FF; font-size:18pt}

Text text-decorationunderline, text-alignleft, right, center text-transformcapitalize, lower-case Setting more than one element to the same style Setting h1 and h2 to have the same font h1,h2 {font-family: Arial} Note the comma to separate the 2 elements

Style in named divs We have used the id attribute to uniquely identify elements This code sets the colours of the element with id = " main " (a div) #main {color: red; background-color: white} Note the # symbol references an id

Styles for classes We have used the class attribute to identify related elements This code sets the colours of the element with class = "name " (a div).name {font-style: italic} Note the. (full stop) symbol references a class