IS1825 Multimedia Development for Internet Applications Lecture 12: IDs, Classes and Internal CSS Rob Gleasure

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

CHAPTER 8 ADVANCED CSS. LEARNING OBJECTIVES Assign formatting styles to a CSS class definition Use a tag’s class attribute to apply the styles defined.
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.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
กระบวนวิชา 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.
Tutorial 4 Formatting Text. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Create a spread heading Indent text Change the line spacing.
Cascading Style Sheets 1. About Lists HTML list code ul, ol, dldl CSS list-item style properties
Design, Formatting, CSS, & Colors 27 February, 2011.
CSE CASCADING STYLE SHEETS CSS Faculty of Computer Science and Engineering.
SM5312 week 6: basic CSS syntax1 An Introduction to Cascading Style Sheets Basic CSS Syntax Nick Foxall.
Controlling Page Style: Cascading Style Sheets (CSS) References: 1.Wang, P.S & Katila, S. (2004). A Introduction to Web Design and Programming. CA: Thomson.
CSSMR.Mostafa badr1. Lesson 3 Creating an Style Sheet Lesson 2 Structure of the Style Lesson 1: What Cascading Style Sheets are?
© 2007 D. J. Foreman CSS-1 Cascading Style Sheets Styles.
Chapter 8 Cascading Style Sheets (CSS). Agenda Definition of a CSS style Types of CSS Styles CSS Backgrounds CSS Text CSS Fonts CSS Links CSS Lists CSS.
Cascading Style Sheets Example
CSS Dvijesh Bhatt.
Cascading Style Sheet (CSS)
1Computer Sciences Department. And use
Cascading Style Sheets Part 1 Presentation by Audrey Altman Exercises from CSS: The Missing Manual.
WDV 101 Intro to Website Development
INTRODUCTION TO HTML5 Styling Text. Change the Font Size  You can use the font-size property to change the font size for a document’s text.  Instead.
Introduction to CSS CSS Syntax - Fort Collins, CO Copyright © XTR Systems, LLC Cascading Style Sheets - Syntax & Semantics Instructor: Joseph DiVerdi,
Doman’s Sections Information in this presentation includes text and images from
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.
Today’s objectives  Review  CSS | Rules | Declarations  HTML Structure document  Class asignment.
HTML, Third Edition--Illustrated Introductory 1 HTML, Third Edition Illustrated Introductory Unit E Formatting with Cascading Style Sheets.
ITCS373: Internet Technology Week 3: Introduction to CSS Dr. Faisal Al-Qaed.
Website Development & Management Working with Style Rules Instructor: John Seydel, Ph.D. CIT Fall
What is 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.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
Tutorial #4 Formatting Text and Links. Tutorial #3 Review - CSS CSS format Selector { property1: value1; /* Comments */ } Embedded, In-Line, and External.
Just A Few More Fun Objectives 1 Having Some Fun With Java Script 2 Using Style Sheets.
CSS Basic (cascading style sheets)
CSS-Lists CSS provides special properties that are designed for lists. It is usually more convenient to use these properties whenever you can. To specify.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 7.
MySQL and PHP Review CSS. Cascading Style Sheet (CSS) Style sheets are files or forms that describe the layout and appearance of a document. Cascading.
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
IS1825: Developing Multimedia Applications for Business Lecture 1: Introduction to CSS Rob Gleasure
Cascading Style Sheets Part 1. CSS vs HTML HTML: Originally intended to markup structure of a document (,...,,,,,...) CSS Developing technology, CSS1,
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.
Web Design and Development for Business Lecture 4 Cascading Style Sheet (CSS)
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
INTRODUCTORY Tutorial 4 Exploring Graphic Elements and Images.
Cascading Style Sheets Robin Burke ECT 270. Outline Midterm The Layout Debate CSS properties Fonts Alignment Color CSS selection selectors pseudo-classes.
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 Class 2 -Add margins to elements on a page. -Set width and height of elements. - CSS shorthand properties for box model. -Style links. -Style tables.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
The Web Wizard’s Guide To DHTML and CSS Chapter 1 A Review of CSS1.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
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.
1 CSS محمد احمدی نیا 2 Of 21 What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements 
LEARN THE QUICK AND EASY WAY! VISUAL QUICKSTART GUIDE HTML and CSS 8th Edition Chapter 15: Lists.
Web Design (15) CSS Opacity, Link Colours & Background Images.
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.
Company LOGO In the Name of Allah,The Most Gracious, The Most Merciful King Khalid University College of Computer and Information System Web pages Development.
Tutorial 3 Designing a Web Page with CSS
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
Html: structure & content CSS: presentation & style A CSS Primer chapter 4.
CSS DHS Web Design. Location Between the & Start with – End with –
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 4 Formatting Text and Links.
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.
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 solve a problem External.
1 Cascading Style Sheets
WebD Introduction to CSS By Manik Rastogi.
COMP 101 Review.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
>> Dynamic CSS Selectors
Presentation transcript:

IS1825 Multimedia Development for Internet Applications Lecture 12: IDs, Classes and Internal CSS Rob Gleasure

IS1825 Today’s lecture  CSS Classes  CSS IDs  Lists in CSS  Links in CSS  Exercise

The class Selector With the class selector you can define different styles for the same type of HTML element. Say that you would like to have two types of text alignment in your document: one right-aligned paragraph, and one centre-aligned paragraph. Here is how you can do it with styles:.right {text-align: right}.center {text-align: center}

The class Selector continued… You then have to use the class attribute in your HTML document: This heading will be right-aligned. This paragraph will be center-aligned.

The class Selector continued… You can also restrict the HTML elements that can apply the class by specifying one tag type before the class name: p.center {text-align: center} now.center can only be referenced legally by tags

The ID selector We declare an ID with "#" and ID name. Two examples: #exampleID1 { background-color: white; } #exampleID2 { text-transform: uppercase; }

The ID selector To use these in our HTML e.g. This heading has an ID name of "exampleID1" and has a white CSS defined background This paragraph has an ID name of "exampleID2“ and has had its text transformed to uppercase letters.

The ID Selector continued… As with classes, you can also restrict the HTML elements that can apply the ID by specifying one tag type before the ID name: p#exampleID1 { background-color: white; } now #exampleID1 can only be referenced legally by tags

IDs vs. Classes What’s the difference between IDs and classes?  An ID can only be referenced once within a page or document. i.e. Only one element will have any given ID!  Classes can be used many times  Use IDs when there is only one occurrence per page (often for layout purposes).  Use classes when there are one or more occurrences per page.

IDs vs. Classes Try out the following code.para1 { text-align:center; color:red; } #para2 { text-align:right; color: blue; } This paragraph is affected by para1 class This paragraph is not affected by any style. This paragraph is affected by the para1 class This paragraph is affected by the para2 id

In HTML we encountered ordered, unordered and definition lists. With CSS we can choose exactly how to format them This may be done using  Style types  Images  Position CSS lists

CSS allows you to chose from a variety of list styles, these include Unordered lists  disc, square, circle, and none e.g. ul {list-style-type: square } Ordered lists  decimal, upper-alpha, lower-alpha, upper-roman, lower-roman, and none e.g. ol {list-style-type: upper-alpha } CSS lists (continued)

CSS list images  You may also want to use an image as a marker for the bullet points e.g. ol { list-style-image: url(“anImage.gif"); } ul { list-style-image: url(“anImage.gif"); } … Try and keep the images relatively simple though CSS lists (continued)

CSS List Positioning  You may also want to adjust the indentation of list items, namely “inside” or “outside”. e.g.ul { list-style-position: inside; } ol { list-style-position: outside; } Note – you may also combine all of these into a single statement e.g.ul { list-style: upper-roman inside url(" CSS lists (continued)

CSS List Positioning  Try out the following code #images { list-style-image:url(' #outside { list-style-type: square } Burger Pizza Chips Water Juice Coke CSS lists (continued)

CSS Links  Links in HTML have 4 states they can be in 1. Link (the link hasn’t been clicked and the mouse isn’t over it) 2. Visited (link has been clicked) 3. Hover (mouse is over it) 4. Active (link is being clicked) Note – the ordering of these states is important CSS links

The format is slightly different for modifying how to display links using CSS. We can change the appearance of each individual state using a slightly modified syntax i.e. a:state { attribute: value } e.g. a:link { color: green } CSS links (continued)

When we are changing more than one state however, we must do so in the correct order, i.e. 1. Link 2. Visited 3. Hover 4. active e.g. a:link { color: blue; } a:visited { color: red; } a:hover { color: green; } a:active { color: white; } CSS links (continued)

Try out the following code a:link { color: blue; } a:visited { color: red; } a:hover { color: green; text-decoration:none; font-size: 500%} a:active { color: orange; font-size:1000%;} Click Me for robot dance! CSS links (continued)

Exercise In this Exercise you must adapt last week’s code to look exactly the same but replace all inline CSS with internal CSS, Open your completed exercise from lecture 02, or copy and paste the solution file from the class share folder into your own is1825 folder Re-save this file as lecture03.html i.e. go file  save as (don’t forget to make sure it saves as type ‘all files’

Exercise (continued) This will require you to create a new internal style sheet in your HTML document’s, using the tag i.e. You will then need to override the defaults for,, and e.g. p { /* CSS code goes in here */}

Exercise (continued) You will then need to create an ID for each of the 6 types of table cell e.g. td#topleft { /* CSS code goes in here */ } which can then be referenced in the HTML e.g.

Exercise Again, you should end up with a page that looks like this