CSS II Digital Media: Communication and design 20.03.2007 IT University of Copenhagen.

Slides:



Advertisements
Similar presentations
CSS Digital Media: Communication and design 2007.
Advertisements

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 Sheets Color and Background Controls Border and Margin Controls (Boxes)
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
Week 9 Using the Box Properties. 9-2 The CSS Visual Formatting Model Describes how the element content boxes should be displayed by the browser –Based.
CSS: Class 1 Background Images, Controlling Position of Background Images, Add Padding to Page Elements, Add Borders to Elements on a Page.
CS4370/6370 Web Development Cascading Style Sheets (CSS)
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.
Web Design & Development Cascading Style Sheets (CSS)
Using CSS for Page Layout. Types of HTML Elements Block-Level Element –Creates blocks of content e.g. div, h1..h6, p, ul, ol, li, table, form –They start.
dmfd. Digital Media: Communication and DesignF2007 Comments Evaluation in my.itu  to  ITU takes into consideration the issues.
XP 1 Working with Cascading Style Sheets Creating a Style for Online Scrapbooks Tutorial 7.
MORE Cascading Style Sheets (The Positioning Model)
Lecture CSS: Cascading Style Sheets. What are Styles? Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation semantics.
Working with Cascading Style Sheets. 2 Objectives Introducing Cascading Style Sheets Using Inline Styles Using Embedded Styles Using an External Style.
PART II dmfd. Digital Media: Communication and DesignF2007 Comments Remember: make a homepage using CSS Next Tuesday: guest lecture on Web.
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 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.
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.
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.
Cascading Style Sheets CSS. CSS Positioning Normal Flow Top -> bottom | left -> right Arranged in the order they appear in the code make room for one.
Cascading Style Sheets CSS. div … Used like a container to group content Gives context to the elements in the grouping Give it a descriptive name with.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
CSS The Definitive Guide Chapter 8.  Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more.
Doman’s Sections Information in this presentation includes text and images from
MCS 270 Cascading Style Sheets (CSS) Gustavus Adolphus College.
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.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
Today’s objectives  Assignment 1  Padding, Margins, Borders  Fluid Layout page  Building accessible Table  Element size with padding and border 
Cascading Style Sheet Bayu Priyambadha, S.Kom. Definition Cascading Style Sheets (CSS) form the presentation layer of the user interface. –Structure (HTML)
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.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
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 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
>> 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.
Week 8 – Part 2 Page Layout Basics Key Concepts 1.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
1 CS428 Web Engineering Lecture 08 Border, Margin, Padding … (CSS - III)
CSS Fun damentals The Document Hierarchy Element Relationships The Box Model.
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.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
CSS – Cascading Style Sheets
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations Slide Set #4: CSS.
Extra-simplified.  Only truly happen when the CSS and HTML are defined as separate files (external style sheet) Introduction The main idea of CSS is.
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations SlideSet #5: Advanced CSS.
CSS - Quiz #3 Lecture Code:
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring 2016 CSS Positioning 1.
HTML and Dreamweaver November 11th. Agenda Box Model Displaying and positioning elements – Padding – Margin – Float – Display – Position HTML Demo.
CIS234A Lecture 6 Instructor Greg D’Andrea. Span and Div The span and div elements are a generic means by which we can add structure to documents. The.
Cascading Style Sheet (CSS) SAMPLE IT133 Pengembangan Web.
Tutorial #5 Working with the Box Model. Tutorial #4 Review - CSS Create a homework page Final Project Discussion Exam on Blackboard Styling Lists (List-style-type,
PERSPECTIVES: TUTORIAL 4 CREATING PAGE LAYOUTS WITH CSS.
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.
Cascading Styles Sheets Positioning HTML elements.
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.
WebD Introduction to CSS By Manik Rastogi.
Cascading Style Sheets (Layout)
Styles and the Box Model
Presentation transcript:

CSS II Digital Media: Communication and design IT University of Copenhagen

Digital Media: Communication and DesignF2007 Comments Notepad++ View code CSS validator Plan for the next weeks Feedback  3D04 

Digital Media: Communication and DesignF2007 Goals of the lecture Revise the basics of CSS Learn the basic properties of the box model Element positioning List styles

Digital Media: Communication and DesignF2007 Index Revision of CSS Box model Colour and background Floating and positioning Lists CSS technique: centering the page

Digital Media: Communication and DesignF2007 Revision of CSS A single style sheet can be used by many XHTML documents Style sheet XHTML- document

Digital Media: Communication and DesignF2007 Syntax selector {property: value;} Declaration CSS HTML.

Digital Media: Communication and DesignF2007 Adding styles 3 ways:  Inline: style added within element tag …  Embedded: styles added in the head of the HTML document selector {property: value;}  External style sheet: separate document containing all styles

Digital Media: Communication and DesignF2007 Class and id class: group similar elements id: identify a unique element p.abstract {font-family: Verdana;} This is the abstract of the article … div#header {background-color: red;} #header {background-color: red;}

Digital Media: Communication and DesignF2007 Index Revision of CSS Box model Colour and background Floating and positioning Lists CSS technique: centering the page

Digital Media: Communication and DesignF2007 Box model margin padding Content area width height Border Outer edge Inner edge

Digital Media: Communication and DesignF2007 Width and height I We would like to see as much CSS1 as possible. CSS2 should be limited to widely-supported elements only. #tall { width: 200px; height: 300px; } #wide { width: 300px; height: 200px; }

Digital Media: Communication and DesignF2007 Width and height II Width and height refer to the dimensions of the content area Total size:  Margins + borders + paddings + content area Length:  Pixels, ems, percentage…  Percentages refer to parent element

Digital Media: Communication and DesignF2007 Margin h1 { margin-top: 3px; margin-right: 20px; margin-bottom: 3px; margin-left: 20px; } h1 { margin: 3px 20px 3px 20px; }

Digital Media: Communication and DesignF2007 Margin II: margin collapse Lorem ipsum dolor sit amet, consectetuer adipiscing elit. h1.top { margin: 10px 20px 10px 20px; } h1.bottom { margin: 20px 20px 20px 20px; }

Digital Media: Communication and DesignF2007 Border Style Width Color div { border-style: dashed; border-width: 10px; border-color: blue; }

Digital Media: Communication and DesignF2007 Padding h1 { padding: 5px 20px 10px 20px; } h1 { padding-top: 5px; padding-right: 10px; padding-bottom: 15px; padding-left: 20px; } 5px 10px 15px20px

Digital Media: Communication and DesignF2007 Index Revision of CSS Box model Colour and background Floating and positioning Lists CSS technique: centering the page

Digital Media: Communication and DesignF2007 h1 { color: #F1156D; color: rgb(241,21,109); color: rgb(94.51%, 8.23%, 42.75%); color: blue; } Naming the colors RGB color:  R: 241 = #F1  G: 21 = #15  B: 109 = #6D 17 colors

Digital Media: Communication and DesignF2007 Background p {padding: 10px;} p.a {background-color: red;} p.b {background-color: blue;} p.c {background-color: green;}

Digital Media: Communication and DesignF2007 Background image div {background-image: url(image.gif);} div {background-image: url(image.gif); background-repeat: no-repeat; background-position: center;}

Digital Media: Communication and DesignF2007 Background image II Text should be readable Background colour should be similar to the colour of the image

Digital Media: Communication and DesignF2007 Index Revision of CSS Box model Colour and background Floating and positioning Lists CSS technique: centering the page

Digital Media: Communication and DesignF2007 Floating and Positioning The normal flow:  Block elements laid from top to bottom  Text elements laid from left to right, flowing in the block element  Objects in the normal flow influence surrounding objects  Floating and positioning change the normal flow

Digital Media: Communication and DesignF2007 Floating image Proca, rex Albanorum, duos filios Numitorem et Amulium habuit. Numitori, qui natu major erat, regnum legavit. Sed Amulio, ira incitatus, fratrem suo regno expulit… img.right {float:right; margin: 10px;}

Digital Media: Communication and DesignF2007 Floating text This is a sidenote on the right explaining some latin… Proca, rex Albanorum, duos filios Numitorem et Amulium habuit… span.sidenote {float:right; margin: 10px; background-color: #999; width:200px;}

Digital Media: Communication and DesignF2007 Floating various elements Elements floated in the same direction:  each object will move in that direction until it reaches the edge of the containing block  if there is not enough room, the second object will move down

Digital Media: Communication and DesignF2007 Clearing img {float: left;} h2 {clear: left;}

Digital Media: Communication and DesignF2007 Positioning 4 types:  static: normal way, objects are rendered in order  relative: moves the element box preserving the original space  absolute: object is removed from the flow and positioned relative to their containing block  fixed: similar to absolute, but object is positioned relative to the viewport

Digital Media: Communication and DesignF2007 Positioning II div {position: absolute; width: 400px; height: 250px; background-color: #CCC; } img {position: absolute; bottom: 0%; left: 0%;} img {position: absolute; top: 100%; left: 0%;}

Digital Media: Communication and DesignF2007 Positioning III div.a {position: absolute; width: 300px; height: 120px; background-color: #CCC; } div.b {position: absolute; top:20px; bottom: 40px; left: 50px; right: 30px; background-color: #666; }

Digital Media: Communication and DesignF2007 Positioning IV: z-index p {position: absolute; padding: 5px; color: black;} #p1 {z-index: 19; background-color: red;} #p2 {z-index: 1; background-color: blue;} span.b {z-index: 72; background-color: green;} Paragraph 1, z-index=19 Paragraph 2, z-index=1. This is a span with z-index 72 And now some more text…

Digital Media: Communication and DesignF2007 Absolute positioning Relative to the edges of the containing block using offset properties Object is removed from the document flow

Digital Media: Communication and DesignF2007 Absolute positioning II #one {position: absolute; top: 10px; left: 10px;} #two {position: absolute; top: 30px; left: 10px;} #three {position: absolute; top: 10px; left: 10px;} p1 p3 p1 p3 10px 30px Viewport

Digital Media: Communication and DesignF2007 Fixed positioning Relative to the edges of the viewport (browser window) Object is removed from the document flow

Digital Media: Communication and DesignF2007 Fixed positioning II p, h1 {margin-left: 150px;} ul {position:fixed; top:0px; left:0px;}

Digital Media: Communication and DesignF2007 Relative positioning Relative to the object’s initial position in the normal flow The original space in the document flow is preserved em {position: relative; top: -36px; right: -36px; background-color: #ccc;}

Digital Media: Communication and DesignF2007 Index Revision of CSS Box model Colour and background Floating and positioning Lists CSS technique: centering the page

Digital Media: Communication and DesignF2007 Lists I ul {list-style-type: disc | circle | square...} ul {list-style-image: url(mybullet.gif);} Style of the marker: Image marker:

Digital Media: Communication and DesignF2007 Lists II: Navigation bar ul#navigation { list-style-type: none; margin: 0px; padding: 0px; } ul#navigation li { display: inline; } Home | CV | Links | Photos </ul<

Digital Media: Communication and DesignF2007 Index Revision of CSS Box model Colour and background Floating and positioning Lists CSS technique: centering the page

Digital Media: Communication and DesignF2007 Centering a page div#page { width: 600px; margin-left: auto; margin-right: auto; } div#page { width: 600px; position: absolute; left: 50%; margin-left: -300px; } Might not work in IE6 Works always

Digital Media: Communication and DesignF2007 Final advise Try your website in different browsers

Digital Media: Communication and DesignF2007 Questions?