Today CSS HTML A project.

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 3-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
Advertisements

Cascading Style Sheets
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 Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Cascading Style Sheets
Cascading Style Sheets
1 Cascading Style Sheets™ (CSS) Outline 5.1 Introduction 5.2 Inline Styles 5.3 Embedded Style Sheets 5.4 Conflicting Styles 5.5 Linking External Style.
CSS Digital Media: Communication and design 2007.
Cascading Style Sheets
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.
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
Very quick intro HTML and CSS. Sample html A Web Title.
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.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
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.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
1 Web Developer & Design Foundations with XHTML Chapter 9 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.
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
Cascading Style Sheets Based on Castro, HTML for the WWW, 6 th edition Ron Gerton, Fall 2007.
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.
1 Dreamweaver CS5 intermediate class by Cookie Setton Build a CSS website WITHOUT TABLES Just when you thought you were starting to understand HTML coding,
CSW131 Steven Battilana 1 CSW 131 – Chapter 5 (More) Advanced CSS Prepared by Prof. B. for use with Teach Yourself Visually Web Design by Ron Huddleston,
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
กระบวนวิชา 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.
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.
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.
More CSS CS HTML id attribute 2 Coding Horror! Our mission is to combine programming and “human” factors with geekiness! output  A unique ID for.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
4.01 Cascading Style Sheets
CM143 Week 4 Introducing CSS. Cascading Style Sheets A definition for the style in which an element of the webpage will be displayed Border width, colour,
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
CSSMR.Mostafa badr1. Lesson 3 Creating an Style Sheet Lesson 2 Structure of the Style Lesson 1: What Cascading Style Sheets are?
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
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.
Cascading style sheets (CSS)
CSS Introduction Cascading Style Sheets Provides a great deal of control over the presentation of the document HTML indicates both semantics of a document.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › 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.
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Introduction to Cascading Style-sheets (CSS) Basharat Mahm ood, Department of Computer Science, CIIT,Islamabad, Pakistan 1.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
ECA225 Applied Interactive Programming Cascading Style Sheets, pt 1 ECA 225 Applied Online Programming.
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.
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.
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.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
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.
WebD Introduction to CSS By Manik Rastogi.
CSS.
Working with Cascading Style Sheets
4.01 Cascading Style Sheets
>> Introduction to CSS
Madam Hazwani binti Rahmat
Cascading Style Sheets (Layout)
Cascading Style Sheets
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Styles and the Box Model
Cascading Style Sheets™ (CSS)
Web Design & Development
4.01 Cascading Style Sheets
Introduction to Cascading Style Sheets (CSS)
Presentation transcript:

Today CSS HTML A project

The Breakdown All web pages can be broken down into bucketized content areas These areas can updated by changing the code on every page, - or - By using cascading style sheets!

Advantages of Style Sheets Saves time Easy to change Keep consistency Give you more control over layout Use styles with JavaScript => DHTML Make it easy to create a common format for all the Web pages

Applying a single style sheet to multiple documents

Basic Structure of a Style Each definition contains: A property A colon A value A semicolon to separate two or more values Can include one or more values h1 {font-size:12pt; color:red}

Style Precedence External style sheet Embedded styles Inline styles

Three Style Types Inline styles Example Add styles to each tag within the HTML file Use it when you need to format just a single section in a web page Example <h1 style=“color:red; font-family: sans-sarif”>IU</h1>

Three Style Types Embedded or internal styles Example A style is applied to the entire HTML file Use it when you need to modify all instances of particular element (e.g., h1) in a web page Example <style> h1 {color:red; font-family:sans-serif} </style>

Creating an Embedded Style <head> <title>Embedded Example</title> <style> (default is “text/css”) Style declarations </style> </head> A style declaration: Selector {attribute1:value1; attribute2:value2; …} Selector = an element in a document (e.g., a header or paragraph)

An Example of an embedded style (p. 353 Fig 7-2) <head> <title>Getting Started</title> <style type=“text/css”> h1 {font-family: sans-serif; color: organge} </style> </head>

Three Style Types External style sheets Example An external style sheet is a text file containing the style definition (declaration) Use it when you need to control the style for an entire web site Example h1, h2, h3, h4, h5, h6 {color:red; font-family:sans-serif} Save this in a new document using a .css extension

Creating an External Style Sheet Open a new blank document in Notepad Type style declarations h1 {color:red; font-family:sans-serif;} Do not include <style> tags Save the document as filename.css

Linking to Style Sheets 1 Open an HTML file Between <head> and </head> add <link href=URL rel=“relation_type” type=“link_type”> URL is the file.css Relation_type=“stylesheet” Link_type=“text/css” Save this file and the .css file in the same web server directory

An example of an external style sheet with an original html file <head> <title>Getting Started</title> <link href=“scraps.css” rel=“stylesheet” type=“text/css” /> </head> h1 {font-family: sans-serif; color: orange} b {color: blue} Text file of css named “stylesheet” html file

Style Sheet Strategies Wherever possible, place your styles in external style sheets Take advantage of the power of CSS to have control over an entire Web site

Using IDs and Classes Use an id to distinguish something, like a paragraph, from the others in a document. For example, to identify a paragraph as “head”, use the code: <p id=“head”>… </p>

Working With Ids To create an ID for a specific tag, use the property: <tag ID=id_name> To apply a style to a specific ID, use: #id_name {style attributes and values}

Classes HTML and XHTML require each id be unique– therefore an id value can only be used once in a document. You can mark a group of elements with a common identifier using the class attribute. <element class=“class”> … </element>

Applying a style to a class

Working With Classes To create a class, enter the following in the HTML tag: <tag CLASS=class_name> <h1 CLASS=FirstHeader>IU</h1> class_name is a name to identify this class of tags To apply a style to a class of tags, use: tag.class_name {style attributes} or .class_name {style attributes}

Working With Classes and Ids The difference between the Class property and the ID property is that the value of the ID property must be unique: you can’t have more than one tag with the same ID value You can apply the same Class value to multiple document tags

Working With DIV <DIV> tag is used for blocks of text, e.g., paragraphs, block quotes, headers, or lists To create a container for block-level elements, use: <DIV CLASS=class_name> Block-level elements </DIV> Class_name is the name of the class You can substitute the ID proper for the Class property (with ID, the syntax for CSS style, #id_name {style attributes and values}

Working With <DIV> DIV.Slogan {font-weigh:bold} style Maxwell…: “We teach… Resulting text <DIV CLASS=Slogan>Maxwell Scientific’s new Slogan is:<BR>”We teach science”</DIV> HTML code

Working With <span> With the <span> tag, you can use inline elements, e.g., <B>, <I> To create a container for inline elements, use: <span CLASS=class_name> inline elements </span>

CSS for Page Layout CSS manipulates the size and location of block-level elements Block-level elements in HTML: Heading tags, e.g., <H1>, <H2> <p> <blockquote> and <address> tags List tags, e.g., <ul>, <ol>, <dl> <div> <body> <hr> <img>

CSS for Page Layout Parts of the block-level elements: Margin Border Padding

CSS for Page Layout (Carey, 7.49) I appreciate the prompt delivery of the pack of star disks. padding border margin

Controlling the Margins To define the margins of an element, use: margin:value where value = a length value (“em” is often used), a percentage (a margin proportional to the element’s width, or auto

Controlling the Margins To set margins on a side, use: margin-top margin-right margin-bottom margin-left E.g., LI {margin-left:2em; margin-right:2em; margin-top:1em; margin-bottom:1em}

Setting the Padding Size To define padding, use: padding: value where value = a length value or a percentage (a padding proportional to the element’s width)

Setting the Padding Size To set margins on a side, use: padding-top padding-right padding-bottom padding-left

Formatting the Border Border can be set in three ways: border-width border-style border-color

Formatting the Border To set the border, use: border:width_value style color To set borders on a side, use: border-top border-bottom border-left border-right Carey 7.52-7.53

Formatting Width & Height of Block-Level Boxes To set the width of a block-level element, use: width:value height:value where value can be a length value, a percentage, or auto E.g., textarea {width:225px; height:100px}

Using the Float Attribute (p. 371-372) To float (wrap) a block-level element, use: float:margin Where margin = right, left, none To prevent an element from wrapping, use: Clear:margin Where margin=right, left, both, none

Using the Float Attribute float:right width:50px clear:right float:right width:50px

Formatting Hypertext Links To remove the style of underlining hypertext, use: A {text-decoration:none} 4 types of hyperlinks can be modified: A:visited {styles for previously visited links} A:link {styles for links that have never visited} A:active {styles for links that are currently being clicked} A:hover {styles when the mouse cursor is hovering over the link}