Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.

Slides:



Advertisements
Similar presentations
Chapter 3 – Web Design Tables & Page Layout
Advertisements

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.
Intro To Cascading Style Sheets By Mario Yannakakis.
Cascading Style Sheets (CSS). Cascading Style Sheets With the explosive growth of the World Wide Web, designers and programmers quickly explored and reached.
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
Cascading Style Sheets: Basics I450 Technology Seminar Copyright 2003, Matt Hottell.
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.
Presenter: James Huang Date: Sept. 26,  Introduction  Basics  Lists  Links  Forms  CSS 2.
CHAPTER 7 STYLING CONTENT WITH CASCADING STYLE SHEETS.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
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.
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.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
CSS(Cascading Style Sheets )
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.
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.
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.
Design, Formatting, CSS, & Colors 27 February, 2011.
4.01 Cascading Style Sheets
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.
Cascading style sheets (CSS)
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
The Characteristics of CSS
Web Technologies Website Development Trade & Industrial Education
Learning HTML. HTML Attributes HTML elements can have attributes Attributes provide additional information about an element Class – specifies a class.
Website Development with Dreamweaver
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.
Just A Few More Fun Objectives 1 Having Some Fun With Java Script 2 Using 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.
WRT235: Writing in Electronic Environments Basic CSS.
Macromedia Dreamweaver 8-- Illustrated Introductory 1 Macromedia Dreamweaver 8 Unit D Formatting Text and Using Cascading Style Sheets.
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.
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Web Foundations TUESDAY, NOVEMBER 19, 2013 LECTURE 31: DREAMWEAVER: MODIFY MENU AND PROPERTY PANEL.
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.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
 Look especially at › File Tips and Shortcuts › Student video.
Spiderman ©Marvel Comics Creating Web Pages (part 1)
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
Positioning Objects with CSS and Tables
1 Preparation for site Create a folder in MyDocuments: beavercheese. Create a subfolder, images Classes, career, DW beginner Download.
CREATING MASTER PAGES Creating a Master Page Using Master Pages Giving your site a professional look and feel Adding Master Page content to existing pages.
Chapter 4 Frames and Cascading Style Sheets. Frames Frames divide a browser window into two or more separate pieces or panes, with each pane containing.
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.
Chapter 3 Designing Your Web Pages. Objectives What is CSS and Why it is needed How CSS looks and how to write it The different ways to add CSS code to.
4.01 Cascading Style Sheets
( Cascading style sheet )
>> Introduction to CSS
ASP.NET Web Controls.
Cascading Style Sheets
Cascading Style Sheets (Layout)
IS333: MULTI-TIER APPLICATION DEVELOPMENT
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets™ (CSS)
Using Cascading Style Sheets (CSS)
Training & Development
4.01 Cascading Style Sheets
5.00 Apply procedures to organize content by using Dreamweaver. (22%)
Introduction to Cascading Style Sheets (CSS)
Presentation transcript:

Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos

Problems of HTML Formatting Not rich enough to create attractive web pages HTML is embedded into your document therefore it cannot be reused later (e.g. change the font) You can’t easily change the formatting at runtime, in the user’s browser. (e.g. change the font size for visually impaired) With HTML formatting all the additional markup in your page adds considerably to the size of the page. This makes it slower to download and harder to maintain.

Cascading Style Sheets (CSS) The HTML document contains what you want to display, while the CSS file defies how you want to display it. Style sheets don’t change with each request, so a browser saves a local copy of the style sheet the first time it loads it. From then on, it uses this cashed copy instead of requesting it from the server over and over again. If it doesn’t download the latest CSS changes use Ctrl+F5 in the browser (not VWD).

Writing your first CSS Create a new file called CssDemo.aspx in the Demos folder. In the Source View type the following code just before the tag: Untitled Page Next, between the opening and closing tags, type the following CSS code:

Writing your first CSS h1 { font-size: 200x; color: Green; } p { color:Blue; font-style: italic; }.RightAligned { text-align: right; }

Writing your first CSS Then, inside the tags enter the following: Welcome to this CSS Demo Page CSS makes it super easy to style your pages. with very little code, you can quickly change the looks of a page. Write the code exactly the way you see it. CSS is case sensitive Switch to Design View to see how it looks

Writing your first CSS The code block from h1 until the closing curly brace (}) between the tags is called a rule set or simply rule. The h1 is called a selector and indicates the element the formatting should be applied. Each line between the curly braces is called a declaration. A declaration consists of a property, followed by a colon and then followed by a value. The semicolon (;) separates the declarations.

CSS – The Language A style sheet can contain multiple declarations like before: h1 { font-size: 200x; color: Green; }

CSS – The Language SELECTORS – what elements of the page must be styled Universal (*) – applies to all elements in your page e.g. * { font-family: Arial; } Type – allows you to point to specific HTML element. e.g. h1 { color: Green; }

CSS – The Language ID – Always prefixed by a hash symbol (#) and allows you to refer to a single element in the page. Within an HTML or ASPX page, you can give each element a unique using the id attribute. With the ID selector, you can change the behavior for that single element, like this: #IntroText { font-style: italic; } You can reuse this ID across pages in your site like this: I am italic because I have the right ID I am not italic because I have a different ID

CSS – The Language Class – It enables you to style multiple HTML elements through the class attribute. This is handy when you want to give the same type of formatting to a number of unrelated HTML elements. The following rule changes the text to bold for all HTML elements that have their class attributes set to Highlight :.Highlight { font-weight: bold; color: Red; } The following code snippet uses the Highlight class to make the contents of a element and a link appear with a bold typeface: This is normal text but this is Red and Bold This is also normal text but this link is Red and Bold as well

CSS – The Language Grouping and Combining Selectors e.g. H1, h2, h3 { color: Red; } Also, you can combine selectors, allowing you to hierarchically point to a specific element in a page. You can do this by separating the selectors with a space. The following example targets all elements that fall within an element with an id of MainContent : #MainContent p { font-size: 18px; }

CSS – The Language Grouping and Combining Selectors (con’t) Grouping is just a shortcut to avoid typing the same declarations over and over again, while combining allows you to target specific elements in your document. With combining, you’re not limited to ID and Type selectors; you can also use it with other selectors like the following example: #MainContent p.Highlight { font-size: 18px; font-weight: bold; }

CSS – The Language Grouping and Combining Selectors (con’t) This rule changes all paragraphs with the class Highlight within an element with its id set to MainContent and leaves all others untouched. The following HTML snippet uses this rule to show the effect: Because I have a class called Highlight, my text appears in bold This text is NOT bold, as it lacks the Highlight class I am NOT bold because I don’t fall within MainContent

CSS – The Language Properties VWD’s Intellisense lists more than 100 items, e.g. Background-color Background-image Border Color Font-size Margin padding

CSS – The Language Values The values depend on the property. e.g. h1 { color: Red; } h1 { color: #FF0000 } h1 { color: rgb(100%, 0%, 0%); }

CSS – The Language Using Shorthand Many of the CSS properties allow you to write a shorthand version as well as a more expanded version, e.g. border: 1px solid Black; This is an easy way to quickly set all four borders of the HTML to the same values. If you want more control, you can use the expanded version, like this: border-top-width: 1px; border-top-style: solid; border-top-color: Black; border-right-width: 1px; border-top-style: solid; border-top-color: Black; etc

Styling the Planet Wrox Homepage Open in Source View the file Default.aspx. Right before the welcome text you created in the previous chapter, add the following HTML. Make sure you replace the existing HTML in the element: Header goes here Menu goes here Sidebar goes here Footer goes here Welcome to Planet Wrox...

Styling the Planet Wrox Homepage Copy from the previous slide the heading and the paragraphs and paste them between the opening and closing tags of the MainContent. This moves your existing code into the main content block. Header goes here Menu goes here Welcome to Planet Wrox... Sidebar goes here Footer goes here

Styling the Planet Wrox Homepage Open the file Styles.css from the Styles folder. If you added some code to this file during an earlier example, remove the code first. At the top of the page, type the following code that uses an ID selector to select the Header : #Header { }

Styling the Planet Wrox Homepage Put your mouse between the curly braces and choose Styles  Build Style from the main menu. From the Modify Style dialog box (see below) choose Background and background color set to silver

Styling the Planet Wrox Homepage Switch to Position category and set width 844 px and height 83 px. Click OK. Your code should be this now: #Header { background-color: #C0C0C0; width: 844px; height: 83px; }

Styling the Planet Wrox Homepage Repeat the previous steps to create the following rules: * { font-family: Arial; } h1 { font-size: 20px; } #PageWrapper { width: 844px; } #MenuWrapper { width: 844 px; } #MainContent { width: 644px; float: left; } #Sidebar { background-color: Gray; width: 200px; float: right; } #Footer { background-color: #C0C0C0; width: 844px; clear: both; }

Styling the Planet Wrox Homepage When you’re done, save and close the file Style.css Open the file Default.aspx and switch to Design View. From the Solution Explorer, drag the file Styles folder onto the page. VWD inserts code in the head section of the page in Markup View that attaches the style sheet to the document (see next slide).

Styling the Planet Wrox Homepage.style1 { color: #FF3300; }

Styling the Planet Wrox Homepage Finally, save the changes to all open documents (press Ctrl+Shift+S) and then request Default.aspx in your browser (Ctrl+F5). Your screen should look something like this:

Styling the Planet Wrox Homepage Why the width of 844px? Because it fits nicely on screen with size 1024X768px. Note that the MainContent area and the Sidebar are positioned next to each other. This is done with the CSS float property: #MainContent { width: 644px; float: left; } #Sidebar { background-color: Gray; width: 200px; float: right; }

Styling the Planet Wrox Homepage To end the float, the Clear property is used #Footer { background-color: #C0C0C0; width: 844px; clear: both; } To tell the browser what styles to apply, you link the style sheet in the head of the page: