Tutorial 3: Designing a Web Page with CSS

Slides:



Advertisements
Similar presentations
Cascading Style Sheets Alternative to HTML tag style.
Advertisements

Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
LIS901N: Style sheet Thomas Krichel Style sheets Style sheets are the officially sanctioned way to add style to your document We will cover.
HTML and CSS. HTML Hyper Text Markup Language Tells browser how to display text and images.
HIGH LEVEL OVERVIEW: CSS CSS SYNTAX CONSISTS OF A SET OF RULES THAT HAVE 3 PARTS: A SELECTOR, A PROPERTY, AND A VALUE. IT’S NOT NECESSARY TO REMEMBER THIS.
CSS-Formatting Review Cascading Style Sheets addstyle to your HTML web pages.
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Presenter: James Huang Date: Sept. 26,  Introduction  Basics  Lists  Links  Forms  CSS 2.
Lecture 5 Use Cases and Style Sheets
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Adding styles. Three alternatives HIT151 Web 'n' Net Web Page Basics /*stylesheet*/ h1,h2,h3 { font-family: verdana, arial, 'sans serif'; } p,table,li.
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.
Links.  Styling Links  Links can be styled with any CSS property (e.g. color, font-family, background-color).  Special for links are that they can.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
HyperText Markup Language (HTML) Uses plain text to add markup instructions to a file. If you can't produce it with a standard keyboard, it can't go into.
Principles of Web Design 5 th Edition Chapter Nine Site Navigation.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
Today’s objectives  Element relations – tree structure  Pseudo classes  Pseudo elements.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
INTRODUCTORY Tutorial 7 Creating Liquid Layouts. XP Objectives Discern the differences among various types of layouts Create a liquid layout Create a.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
Client-Side Internet and Web Programming
Cascading Style Sheets Based on Castro, HTML for the WWW, 6 th edition Ron Gerton, Fall 2007.
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.
Cascading Style Sheet CSS CS1520 Ali Alanjawi. 2 TA Information Ali Alanjawi Homepage: Office:
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(Cascading Style Sheets )
Part 3 Introduction to CSS. CSS Text Text Styles h1 {color: green} // rgb(0,255,0), #00ff00 h2{letter-spacing: 0.5cm} // 2px h3 {text-align: right} //
กระบวนวิชา 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.
Measurement Many CSS properties (values within the declaration) require that you specify a unit of measurement, such as spacing between elements, border.
© 2010, Robert K. Moniot Chapter 5 CSS : Cascading Style Sheets 1.
Unit 20 - Client Side Customisation of Web Pages
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
CSS Cascading Style Sheets Brief Introduction
Dr. Ahmet Cengizhan Dirican BIL 374 Internet Technologies 3. CSS.
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
Principles of Web Design 6 th Edition Chapter 4 – Cascading Style Sheets.
WDV 101 Intro to Website Development
Tutorial #4 Formatting Text and Links. Tutorial #3 Review - CSS CSS format Selector { property1: value1; /* Comments */ } Embedded, In-Line, and External.
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
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.
Tutorial 3 Designing a Web Page with CSS
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 4 Formatting Text and Links.
1 Cascading Style Sheets
WebD Introduction to CSS By Manik Rastogi.
CSS.
Cascading Style Sheets
HTML WITH CSS.
CS3220 Web and Internet Programming CSS Basics
LAB Work 01 MBA 61062: E-Commerce
HTML WITH CSS.
Cascading Style Sheets
3.1 Introduction - The CSS1 specification was developed in 1996
Cascading Style Sheets (Formatting)
Web Development & Design Foundations with HTML5 7th Edition
Chapter 7 Page Layout Basics Key Concepts
Web Development & Design Foundations with HTML5 8th Edition
3.5 Property Value Forms - There are 60 different properties in 7 categories: - Fonts - Lists - Alignment of text - Margins - Colors - Backgrounds - Borders.
Basics of Web Design Chapter 7 Page Layout Basics Key Concepts
CSS Style Sheets: Intro
محمد احمدی نیا CSS محمد احمدی نیا
CS3220 Web and Internet Programming CSS Basics
CS3220 Web and Internet Programming CSS Basics
Presentation transcript:

Tutorial 3: Designing a Web Page with CSS Session 3.3.

Objectives Designing a list Understand basic selectors Using pseudo-classes and pseudo-elements

Designing a list List categories Code in HTML To define the appearance of the list marker, use the style list-style-type: type; where type is disc, circle, square, decimal, decimal-leading-zero, lower-roman, upper-roman, lower-alpha, upper-alpha, lower-greek, upper-greek, or none. Use “Arial Black” if available, otherwise use Georgia and if Arial Black and Georgia are not available, use Tahoma.

Designing a list Pc = picas Relative units: expressed relative to the size of other objects within the Web page. h1{font-size: 2em;}: It expresses the size relative to the font size of the parent element. For h1 heading, the parent element is the Web page body so h1 is twice the size of the body text. H1{font-size: 200%;}: The font size of h1 is twice the font of the body text

Designing a list To insert a graphic image as a list marker, use the style list-style-image: url(url); where url is the URL of the graphic image file. To set the position of list markers, use the style list-style-position: position; where position is inside or outside. Web safe fonts: Fonts supported by all browsers => limited Web fonts

Designing a list To define all of the list style properties in a single style, use the following style: list-style: type url(url) position; To set the indentation of a list, apply the style padding-left: size; where size is the length that the list should be indented.

Practice - Design a list Open the hs_styles.css of the Sunny Acres website. For unordered lists within the nav element, remove the bullet marker and set the padding-left property to 0 pixel. For unordered lists nested within the section element, create a style rule that displays the image file flake.png as the bullet marker.

Basic Selector Types Selector = Element on the page you want to style. Three basic selector types: Element selectors Class selectors Id selectors Different situations: apply CSS rule broadly across the site Target smaller number of elements or even a single element.

Basic Selector Types Element Selectors: Global selectors based on individual HTML elements p { font-family: Arial, Helvetica, Sans Serif;} ul {color: black;} Effect every element of that type in the document Very broad Set global site-wise style

Class Selectors Attributes applied to the HTML elements of your choice. Notice the . In front of the class name (the class name is your choice). You can use the class as many times as you want and apply it to as many elements as you want.

id Selectors Attribute selector based on ID attributes applied to HTML elements.

Class and id naming Convention No whitespace or special characters CSS is case-sensitive Establish standards for your CSS and stay consistent with them

Practice – Classes and Ids Add the id “hourslist” to the first unordered list element within the section element. Add the class “directionslist” to the second unordered list element within the section element. Delete style rule for the unordered lists within the section element. Create a style rule for the unordered list with the hourslist id that displays the image flake.png as the bullet marker. Create a style rule for the unordered list with the directionslist class that the bullet type as square.

Using pseudo classes and elements A pseudo-class is a classification of an element based on its current status, position, or use in the document. CSS pseudo-elements are used to add special effects to some selectors. Syntax: selector:pseudo-class/pseudo-element {styles;}

Pseudo Example Example description link a:link Selects all unvisited links visited a:visited Selects all visited links active a:active Selects the active link hover a:hover Selects links on mouse over focus input:focus Selects the input element which has focus first-letter p:first-letter Selects the first letter of every <p> element first-line p: first-line Selects the first line of every <p> element first-of-type p: first-of-type Selects every <p> element that is the first <p> element of its parent first-child p:first-child Selects every <p> elements that is the first child of its parent before p:before Insert before after every <p> element after p:after Insert content after every <p> element lang(language) p: lang(it) Selects every <p> element with a lang attribute value starting with "it"

Using pseudo-classes and elements Examples: a:link { color:red; text-decoration:none; } a: hover { text-decoration:underline;

Using pseudo classes and elements Examples: p:first-letter { color:#ff0000; font-size:xx-large; } p:first-line { color:#0000ff; font-variant:small-caps; }

Using pseudo-classes and elements Examples: h1:before{ content:url(banner.gif); } h1:after{ content:url(logo.gif); }

Using pseudo-classes and elements Example: nav ul li:first-of-type { text-transform: uppercase; }

Practice - pseudo-classes and elements For the first list item of the unordered list within the nav element, create a style rule to: Increase the font size to 150% Display the text in small caps Display the text in bold For every hypertext link within the navigation list, create a style that removes underlining and set the font color to white. When the user hovers the mouse pointer over list items in the navigation list, change the background color to the value (148, 51, 62). When the user hovers a hypertext link in the navigation list, change the font color to yellow.