Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:

Slides:



Advertisements
Similar presentations
HTML and CSS. HTML Hyper Text Markup Language Tells browser how to display text and images.
Advertisements

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.
Web Pages Week 10 This week: CSS Next week: CSS – Part 2.
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 Style.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
Cascading Style Sheets
Cascading Style Sheets
Cascading Style Sheets: Basics I450 Technology Seminar Copyright 2003, Matt Hottell.
Cascading Style Sheets
Today CSS HTML A project.
Presenter: James Huang Date: Sept. 26,  Introduction  Basics  Lists  Links  Forms  CSS 2.
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.
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.
1 Web Developer & Design Foundations with XHTML Chapter 9 Key Concepts.
End User Computing An Introduction to CSS Sujana Jyothi Research Lab1, Callan Building, Department of Computer Science
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.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
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,
กระบวนวิชา 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.
Class four: the box model and positioning. is an HTML tag which allows you to create an element out of inline text. It doesn’t mean anything! try it:
ADVANCED CSS William Neely CEO, Piecewise.com. CSS FONTS AND TEXT CSS ‣ Line-height allows to indicate the amount of space between lines; allows for equal.
Unit 20 - Client Side Customisation of Web Pages
Chapter 8 Creating Style Sheets.
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
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.
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.
CSS Basics LIS Webteam April 8, Why CSS? What’s wrong with HTML? Structure vs Style Early web design used hacks to style webpages with HTML – like.
4.01 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.
Advanced CSS - Page Layout. Advanced CSS  Compound Selectors:  Is a Dreamweaver term, not a CSS term.  Describes more advanced types of selectors such.
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.
Learning HTML. HTML Attributes HTML elements can have attributes Attributes provide additional information about an element Class – specifies a class.
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.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
CSS Basic (cascading style sheets)
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 7.
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
Course created by Sarah Phillips BBCD Melbourne BAPDCOM Version 1 – April 2013.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
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.
Cascading Style Sheets (CSS) Internal Style Sheets Classes
4.01 Cascading Style Sheets
( Cascading style sheet )
CSS Layouts: Grouping Elements
Web Systems & Technologies
Cascading Style Sheets
CSS.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
CSS Borders and Margins.
What are Cascading Stylesheets (CSS)?
How to use the CSS box model for spacing, borders, and backgrounds
4.01 Cascading Style Sheets
Session IV Chapter 15 - How Work with Fonts and Printing
Web Programming and Design
Introduction to Cascading Style Sheets (CSS)
Presentation transcript:

Web Pages and Style Sheets Bert Wachsmuth

HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations: items This is some text.  XHTML makes a document “well-formed” and easier to interpret by browsers  Especially important for browsers on mobile device with access to fewer resources

XHTML Every XHTML document must have the following structure: … Title goes here...

XML There is also an XML standard, a generalized version of XHTML with arbitrary tags:  XML is designed to describe and structure data  HTML is designed to describe how data should be formatted  XHTML is designed to structure data with tags that have a fixed meaning Some text John Doe Jane Smith John Doe

Expression Web Expression web is a sophisticated web editor that:  has a WYSIWYG (what you see is what you get) mode as well as a code view of the page you are editing  provides help for all HTML tags, parameters, and options  can edit pages on your local computer as well as on the remote server  can synchronize pages between your local computer and a remote web server  has templates for creating complete web sites  can manage complete web pages  provides support for programming in JavaScript  is “standards-compliant”

Exercise Start Expression Web and create  a new page with a title  a main header  some paragraph of text,  a sub header  a list of links  an image  a centered table Make sure to switch between the various display modes to see the HTML codes, their options, and how they look.

Style Sheets HTML has evolved into a mixed-up language: logical structure-defining elements are mixed with pure formatting directives. It is advantageous to separate those two:  want to define logical structures for our content  want to separately define formatting options for the structures  want to be able to apply one set of formatting rules to multiple web pages for uniformity That’s what (X)HTML + CSS (Cascading Style Sheets) accomplishes.  Style sheets define how a text structure should look like  (X)HTML defines where the structures start and end and how they are related.

Style Sheets (2) Styles can be defined in three different ways  external: the styles are define in a separate file, usually with.css extension  internal: the styles are defined inside the HTML file, usually in the header section  inline: the style is defined inside an existing tag The most useful one is an external style sheet, so stick with that.

Style Sheets (3) Each style in a style sheet has three parts:  a selector  one or more properties  one or more values for each property Syntax: selector { property1: value1 [value2...]; property2: value1 [value2...]; … }

Style Sheets (4) To attach a style sheet to an XHTML document, use the tag, as in: Title goes here Content goes here

Exercise  Use Expression Web to create new HTML document and a new style sheet  Save the empty files to the same directory.  Use the “Format” menu to attach your new style sheet to your web page  Create a level-1 headline, a list, and a paragraph of text in your web document  Check the source of your document to verify that Expression Web has inserted the correct framework and attached the right style sheet.  Define the following style: h1 { border: 2px black solid; }  Save all, switch to HTML document and reload (F5) or view with browser (F12)

Style Sheets (5) Style sheets define three types of styles:  #id - ID’s are frequently used to define large structures in an HTML document. Each id can be used only once in each HTML document .class - Classes are styles that can be reused and applied to different elements via a class parameter, such as …  Element - Elements are used to redefine how existing HTML elements are to be formatted Common style properties are fonts, alignment, borders, margins, paddings, and locations.

Lengths, Sizes, and Percentages Many properties refer to sizes, measured in a variety of units such as:  em (such as font-size: 2em) is the unit for the calculated size of a font. So "2em", for example, is two times the current font size  px (such as font-size: 12px) is the unit for pixels  pt (such as font-size: 12pt) is the unit for points  % (such as font-size: 80%) is the unit for percentages When a value is zero, you do not need to state a unit. The most useful units for font-sizes are 'em' or '%', whereas 'px' should be used for border sizes.

Colors Colors are specified as name, an rgb (red/green/blue) value or a hex code. The following colors are all the same:  rgb(255,0,0)  rgb(100%,0%,0%)  #ff0000  red Not all colors go well together, but there are several sites where you can pick appealing, matching colors. Try for example

Exercise Change:  Large font overall and some background color  Header text color to grey on green background  Large font size  more margins  borders only at the bottom and right side. Then define a class style to center text and apply it to a paragraph of text as well as the header.

Common Use of ID Styles (1)  Define overall segments such as a header, a footer, a menu region, etc.

Common Use of ID Styles (2) body { margin: 0; padding: 0; } #container { min-width: 600px; } #menu { width: 200px; float: left; } #content { margin-left: 200px; }

Common Use of ID Styles (3) Create a new HTML file. Add the following HTML tags The Menu Menu 1 Menu 2 Welcome Here is the page content (There is an XHTML violation – find it)

Common Use of ID Styles (3) Small changes can have big unexpected effects: In the above style sheet, change the “container” style to the following, then check the effect: #container { width: 900px; margin: 0 auto; } margin can have 1, 2, or 4 values:  1 value – applies to all four sides  2 values – apply top/bottom and right/left  4 values – for the four sides

Common Use of ID Styles (4) HTML-element styles can be redefined inside different id sections so that they only apply to the HTML tag inside the id section. Add the following styles to your style sheet: #menu h1 { font-size: 10px; color: #000080; } #content h1 { font-size: 18px; color: white; background-color: #505050; }

Defining Buttons via Styles Now let’s be slick and define pseudo-buttons for our menu. Add the following styles without changing your HTML document: #menu ul { list-style-type: none; display: block; } #menu li { display: block; }

Defining Buttons via Styles Not much has changed, but the bullets have disappeared from the list items. Now add the following: #menu a { color: #ffffff; background-color: #000080; text-decoration: none; } #menu a:hover { color: #000000; background-color: #4040FF; text-decoration: none; }

#menu ul { list-style-type: none; display: block; margin: 0; padding: 0; width: 100%; } #menu li { display: block; margin: 0; padding: 0; width: 100%; } #menu a { color: #ffffff; background-color: #000080; text-decoration: none; display: block; } #menu a:hover { color: #000000; background-color: #4040FF; text-decoration: none; display: block; }

Exercise: Create a class style named newsbox that allows you to post ‘headline’ news in a small box floating on the right side of your content. Add a few links to try it out.

Cascading Style Sheets  Create a second style sheet called “defaults.css”, add styles for each ID defined previously #container { margin: 0; padding: 0; border: 0; } /* same for menu, content, and footer  save this style sheet in the same directory as the other files  add the following line to your HTML document to attach this sheet