/k/k 1212 Cascading Style Sheets Part three Marko Boon

Slides:



Advertisements
Similar presentations
CSS CSS Precise Aesthetic Control. Cascading Style Sheets Though they can be put in HTML header, usually a separate page that the HTML links to Contains.
Advertisements

9-May-15 More CSS. 2 A different emphasis CSS is the same for XML as it is for HTML and XHTML, but-- XML contains no display information If you want your.
Today’s objectives Site performance Padding, Margins, Borders
Tutorial 4: Creating page layout with css
Working with Cascading Style Sheets
CASCADING STYLE SHEETS CSS. 2 What CSS means?  CSS is an extension to basic HTML that allows you to style your web pages.  It separates the part that.
Cascading Style Sheets SP.772 May 6, CSS Useful for creating one unified look for an entire web site. Helps to seperate style from content. Can.
CSS II Digital Media: Communication and design IT University of Copenhagen.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
MORE Cascading Style Sheets (The Positioning Model)
14-Jul-15 CSS Applications to XML. 2 A different emphasis CSS is the same for XML as it is for HTML, but-- HTML already does a pretty good job of layout.
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
CSS Margins. The Margin properties define the space around elements. It is possible to use negative values to overlap content. The top, right, bottom,
Cascading Style Sheets – Block Level. Block Level Style So far we have done text-level CSS With block level CSS, we used a generic container tag Similarly.
Slide 1 of 83 Table Borders To specify table borders in CSS, use the border property. The example below specifies a black border for table, th, and td.
Working with Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of a document.
Cascading Style Sheet Basics Pepper. Looking at the HTML See the surrounding tags See head, body, paragraph, header See the ending tags See the list.
Cascading Style Sheets CS3505. What are CSS? Method for adding style attributes consistently to HML tags Cascading because styles are applied in order.
Cascading Style Sheets Billy Toy Cascading Style Sheets Syntax review How to Implement style sheets Background properties Text properties.
LING 408/508: Programming for Linguists
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.
CSS Introduction Cascading Style Sheets Provides a great deal of control over the presentation of the document HTML indicates both semantics of a document.
Tutorial 4 Creating Special Effects with CSS
CSS Positioning Creating Special Effects with CSS CS202 Working with Cascading Style Sheets (Chapter 4) CS202 1.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Introduction to CS520/CS596_026 Lecture One Gordon Tian Fall 2015.
Cascading Style Sheets by Pavlovic Nenad by. Presentation Contents  What is CSS?  Why CSS?  Types of Style Sheets  Style Sheets Syntax  Box Formatting.
HTML, Third Edition--Illustrated Introductory 1 HTML, Third Edition Illustrated Introductory Unit E Formatting with Cascading Style Sheets.
CSS Netcentric. What is CSS O CSS stands for Cascading Style Sheets O Styles define how to display HTML elements O Styles were added to HTML 4.0 to solve.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Today’s objectives  Assignment 1  Padding, Margins, Borders  Fluid Layout page  Building accessible Table  Element size with padding and border 
Css ( CASCADING STYLE SHEETs ) CSS Box Model. All HTML elements can be considered as boxes. In CSS, the term "box model" is used when talking about design.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 7.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 10: A Deeper Look at CCS- Spring 2011.
CHAPTER 3 CSS & CSS3 อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Tutorial 7.
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.
Chcslonline.org Text –wrapping around Images. chcslonline.org To wrap text around an image, lets set up a style in our style sheet. open a new notepad.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Web Foundations THURSDAY, OCTOBER 3, 2013 LECTURE 6: CSS CONTINUED.
>> The “Box” Model. Pre-requisite Create a new project in Netbeans called Week5 Create a new html file and name it box.html Create a new css file and.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
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.
Course created by Sarah Phillips BBCD Melbourne BAPDCOM Version 1 – April 2013.
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.
1 CS428 Web Engineering Lecture 08 Border, Margin, Padding … (CSS - III)
LING 408/508: Programming for Linguists Lecture 10 September 30 th.
CSS Fun damentals The Document Hierarchy Element Relationships The Box Model.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  CSS Box Model  CSS properties for border  CSS properties for.
11/12/2015 Box Model Reed Crouch. 11/12/2015  HTML elements can be considered as boxes. In CSS, the term "box model" is used when referring to layout.
CNIT 132 – Week 4 Cascading Style Sheets. Introducing Cascading Style Sheets Style sheets are files or forms that describe the layout and appearance of.
3.2 Cascading Style Sheets. 2 Positioning Elements Normally, elements are laid out on the page in the order that they are defined in the XHTML document.
CSS – Cascading Style Sheets
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations SlideSet #5: Advanced CSS.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring 2016 CSS Positioning 1.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
HTML and Dreamweaver November 11th. Agenda Box Model Displaying and positioning elements – Padding – Margin – Float – Display – Position HTML Demo.
Chapter 7.  Change body and link styles  Create a drop-down menu  Change color and font styles in the menu  Create a pop-up effect using CSS  Utilize.
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
XP Tutorial 7New Perspectives on HTML and XHTML, Comprehensive 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
Welcome To Website Design, Hosting And Management Prepared By Webdev Solution ip ,223,96.
HTML & CSS Contents: the different ways we can use to apply CSS to The HTML documents CSS Colors and Background CSS Fonts CSS Text CSS box model: padding,
Unit 3 - Review. Topics 1. Tag, Attribute, Value 2. CSS Rule Syntax + link 3. Categories of Selectors 4. Inline vs Block Tags 5. CSS Layout 6. CSS Box.
Introduction to CS520/CS596_026 Lecture One Gordon Tian Fall 2015.
CSS Layouts: Grouping Elements
Cascading Style Sheet List Properties Box Properties Pseudoclass
Cascading Style Sheet List Properties Box Properties Pseudoclass
List Properties Box Properties Pseudoclass
Presentation transcript:

/k/k 1212 Cascading Style Sheets Part three Marko Boon

/k/k 1212 Positioning Margins Padding Dimensions Positioning Layers and Visibility Pseudo-Classes Connection to JavaScript Part 3

/k/k 1212 Margins PropertyValues margin-left margin-right margin-top margin-bottom auto length % Margins define the space around elements.

/k/k 1212 Margins - Example body { margin-top:10px; margin-bottom:10px; margin-left:10%; margin-right:auto; }

/k/k 1212 Padding PropertyValues padding-left padding-right padding-top padding-bottom length % Padding defines the space between the element border and the element content.

/k/k 1212 Padding - Example td { padding-left:3px; padding-right:3px; padding-top:3px; padding-bottom:3px; }

/k/k 1212 Padding, Margin and Border shortcuts td { padding-left:1px; padding-right:2px; padding-top:3px; padding-bottom:4px; } Also applies to: border-color border-width margin td { padding:3px 2px 4px 1px; }

/k/k 1212 Dimensions PropertyValues height width auto length % line-heightnormal number length %

/k/k 1212 Dimensions - Example body { line-height:1.5; } img { width:60%; border-width:1px; border-style:solid; }

/k/k 1212 Positioning PropertyValues floatleft, right none positionstatic absolute relative

/k/k 1212 Positioning (position = absolute/relative) PropertyValues left right top bottom auto % length

/k/k 1212 Positioning - Example <img src= " leftupper.jpg " style= " position:absolute;left:5px;top:5px " > <img src= " rightupper.jpg " style= " position:absolute;right:5px;top:5px " >

/k/k 1212 Layers and Visibility PropertyValues z-indexauto number visibilityvisible hidden clipauto rect(top right bottom left )

/k/k 1212 Layers and Visibility - Example 1 <span style="width:200;height:100; background-color:blue; position:relative;z-index:5"> Necessary! Otherwise z-index is disregarded!

/k/k 1212 Layers and Visibility - Example 1

/k/k 1212 Layers and Visibility - Example 1 <span style="width:200;height:100; background-color:red; position:relative;left:-100;top:50">

/k/k 1212 Layers and Visibility - Example 1 <span style="width:200;height:100; background-color:red; position:relative;left:-100;top:50">

/k/k 1212 Layers and Visibility - Example 1 <span style="width:200;height:100; background-color:red; position:relative;left:-100;top:50; z-index:4">

/k/k 1212 Layers and Visibility - Example 1 <span style="width:200;height:100; background-color:red; position:relative;left:-100;top:50; z-index:4">

/k/k 1212 Layers and Visibility - Example 2 Text Text

/k/k 1212 Layers and Visibility - Example 2 Text Text

/k/k 1212 Layers and Visibility - Example 2 Text

/k/k 1212 Layers and Visibility - Example 2 Text Text

/k/k 1212 Layers and Visibility - Example 2 Text Text Clipping needs absolute position! (but no top, left, …)

/k/k 1212 Layers and Visibility - Example 2 Text Text

/k/k 1212 Pseudo-Classes Used in CSS to add different effects to some selectors, or to a part of some selectors

/k/k 1212 Pseudo-Classes selector:pseudo-class { property:value; }

/k/k 1212 Pseudo-Classes a { text-decoration:none; color:blue; } a:hover { text-decoration:underline; color:blue; } Other pseudo-classes: a:active a:visited

/k/k 1212 How to link JavaScript to StyleSheets Any HTML tag that has an ID, is an object in JavaScript. Text HTML: JavaScript: p = document.getElementById("par1")

/k/k 1212 Every HTML object in JavaScript, has the style property. This property, which is an object itself, enables you to use any CSS style command: CSS: border-width, font-size JavaScript: borderWidth, fontSize etc. How to link JavaScript to StyleSheets

/k/k 1212 Example of CSS in JavaScript: <p style="position:relative;left:0" id="par1"> Some text in a paragraph. p = document.getElementById("par1"); indent = parseInt(p.style.left); p.style.left = indent + 10;

/k/k 1212 Content of the tags P, DIV, SPAN, H2 etc. can be changed in the following way: als volgt gewijzigd worden: Text p = document.getElementById("div1"); p.innerHTML = "New text"; How to link JavaScript to StyleSheets

/k/k 1212 There is a method that returns all elements with a given tag name: pArray = document.getElementsByTagName("p"); for (i = 0; i < pArray.length; i++) pArray[i].style.left = 10; How to link JavaScript to StyleSheets

/k/k 1212 Example: Menus 1.Create the menus in a 2 × n table FileEditHelp

/k/k 1212 Example: Menus 2.Add an invisible span ( visibility=hidden ) in every lower table cell. Give each span a unique id. FileEditHelp

/k/k 1212 Example: Menus 3.Add a table in each span,containing the menu items. FileEditHelp Open Save Save As Close Copy Cut Paste Index Content s About

/k/k 1212 Example: Menus 4.Add JavaScript event handlers to the menus: FileEditHelp Open Save Save As Close Copy Cut Paste Index Content s About

/k/k 1212 Example: Menus 5.Add JavaScript event handlers to the spans: FileEditHelp Open Save Save As Close Copy Cut Paste Index Content s About

/k/k 1212 Example: Menus 5.Add JavaScript event handlers to the spans:

/k/k 1212 Example: Menus 5.Add event handlers to the menu items: Open FileEditHelp Open Save Save As Close Copy Cut Paste Index Content s About

/k/k 1212 Example: Menus 6.Write the JavaScript code: function clickMenu(n) { } function clickMenuItem(n, m) { outMenu(n); // whatever you want to do // e.g. open a new page }

/k/k 1212 Example: Menus 6.Write the JavaScript code: function overMenu(n) { hideMenus(); m = document.getElementById("menu"+n); m.style.visibility="visible"; } function outMenu(n) { m = document.getElementById("menu"+n); m.style.visibility="hidden"; }

/k/k 1212 Example: Menus Result in an HTML file: Click here if you downloaded everything on your local diskClick here Click here if you have an Internet connectionClick here

/k/k 1212 Warnings almost none of this works in Netscape 4 there can (and will) always be little differences between Netscape 6+ and Internet Explorer Test everything in multiple browsers!