SEEM4570 Tutorial 3: CSS + CSS3.0

Slides:



Advertisements
Similar presentations
LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties –List properties –Classification properties Fun with selectors.
Advertisements

Table, List, Blocks, Inline Style
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
CSS Layout Crash Course An Advance CSS Tutorial. Inline vs. Block Many HTML elements have a default display setting of Block. Block elements take up the.
Cascading Style Sheets
Chapter 6 More CSS Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Part 5 Introduction to CSS. CSS Display - Block and Inline Elements A block element is an element that takes up the full width available, and has a line.
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.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
CSS(Cascading Style Sheets )
กระบวนวิชา 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.
Basics of Web Design Chapter 6 More CSS Basics Key Concepts.
Tutorial 6 Creating Fixed-Width Layouts
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.
1 The Structure of a Web Table beginning of the table structure first row of three in the table end of the table structure table cells You do not need.
Principles of Web Design 6 th Edition Chapter 10 – Data Tables.
WEEK 3 Lecture 2 CSS TEXT AND FONT PROPERTY Copyright © Corporate Health and Consultancy Services Limited Web Developmen t 15.WD.1 Mildred Fakoya.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
CHAPTER 3 CSS & CSS3 อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Designing a Web Page with Tables. A text table: contains only text, evenly spaced on the Web page in rows and columns uses only standard word processing.
Tutorial 5 Working with Web Tables. XP Objectives Explore the structure of a Web table Create headings and cells in a table Create cells that span multiple.
CIS234A Lecture 8 Instructor Greg D’Andrea. Review Text Table contains only text, evenly spaced on the Web page in rows and columns uses only standard.
INTRODUCTORY Tutorial 5 Using CSS for Layout and Printing.
CONTROLLING Page layout
IN THE DOCUMENT OBJECT MODEL, EACH LINE OF HTML IS AN ELEMENT (AN OBJECT), ABLE TO HAVE ATTRIBUTES, PROPERTIES AND VALUES. CSS TELLS THE BROWSER HOW TO.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
CSS.
Laying out Elements with CSS
CSS for Styling By Jinzhu Gao.
Cascading Style Sheets Layout
Cascading Style Sheets Boxes
CS3220 Web and Internet Programming CSS Basics
CSS Layouts CH 13.
4.01 Cascading Style Sheets
( Cascading style sheet )
CSS Layouts: Grouping Elements
Webpage layout using CSS
CSS3 Style of the HTML document CSS2+New Specifications Differences
Working with Tables: Module A: Table Basics
Tutorial 4 Topic: CSS 3.0 Li Xu
Cao Yuewen SEEM4570 Tutorial 03: CSS Cao Yuewen
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Advanced CSS BIS1523 – Lecture 20.
CSS3 Cascading Style Sheet
Chapter 7 Tables.
Web Systems & Technologies
The Internet 10/25/11 XHTML Tables
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Chapter 6 More CSS Basics Key Concepts
Cascading Style Sheets
CSS – Properties & Values
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
MORE Cascading Style Sheets (The Positioning Model)
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
DynamicHTML Cascading Style Sheet Internet Technology.
Basics of Web Design Chapter 6 More CSS Basics Key Concepts
DynamicHTML Cascading Style Sheet Internet Technology.
How to use the CSS box model for spacing, borders, and backgrounds
CS3220 Web and Internet Programming CSS Basics
CS3220 Web and Internet Programming CSS Basics
Principles of Web Design 5th Edition
Laying out Elements with CSS
CS3220 Web and Internet Programming More CSS
Cascading Style Sheets
4.01 Cascading Style Sheets
CS3220 Web and Internet Programming More CSS
CSc 337 Lecture 5: Grid layout.
Web Programming and Design
CS3220 Web and Internet Programming More CSS
Presentation transcript:

SEEM4570 Tutorial 3: CSS + CSS3.0 Cao Yuewen ywcao@se.cuhk.edu.hk 2018.10.04

What is CSS ? CSS stands for Cascading Style Sheets CSS describes how HTML elements are to be displayed

CSS Rule Structure CSS rule-set consists of a selector and a declaration block: The selector points to the HTML element you want to style The declaration block contains one or more declarations Each declaration includes a CSS property name and a value Each declaration separates with a semi-colon

ID in CSS Specify a style for a unique element by referring to the “id” in the HTML element. The style is defined by “#” in CSS <head> <style> #para1{ color:red; } </style> </head> <body> <p id="para1">A style paragraph</p> <p id="para1">Another style paragraph</p> </body>

Class in CSS Specify a style for a unique of elements by referring to the “class” in the HTML element. The style is defined by “.” in CSS <head> <style> .para1{ color:red; } </style> </head> <body> <p class="para1">A style paragraph</p> <p class="para1">Another style paragraph</p> </body>

Some Useful Elements - Table Table <table> <th> head <tr>table row <td>table data Table border Table width and height Table color Alignment Table Padding Horizontal Dividers Hoverable Table Apply style to a specific table …

Some Useful Elements - Table

Some Useful Elements - Layer We use <div> to represent it. You need to understand the layout first:

Some Useful Elements - Position Position properties allow you to position an element. It can also specify what should happen if an element’s content is too big or which element overlaps with one another. There are four different position value: Static(default) Relative Fixed Absolute

Some Useful Elements - Position Position: relative A relative positioned element is positioned relative to its normal position. Example: div.relative{ position: relative; left: 30px; border: 3px; }

Some Useful Elements - Position Position: fixed A fixed positioned element is positioned relative to the browser window. Example: div.fixed{ position: fixed; bottom: 0; right: 0; width: 300px; border:3px; }

Some Useful Elements - Position Position: absolute An absolute positioned element is positioned relative to the nearest positioned ancestor. If no such ancestor is found, it uses the document body, and move along with page scrolling. Example: div.relative { position: relative; width: 400px; height: 200px; border: 3px; } div.absolute { position: absolute; bottom: 0; right: 0; width: 200px; height: 100px; border: 3px; } <div class="relative">This div element has position: relative; <div class="absolute">This div element has position: absolute;</div> </div>

Some Useful Elements - Position Position: overlapping Elements can overlap other elements if needed. The z-index property specifies the stack order of an element. Example: img {     position: absolute;     left: 0px;     top: 0px;     z-index: -1; }

Some Useful Elements - Position

Some Useful Elements - Display Display property specifies how an element is displayed. Commonly used values: div { display: inline; /* Default of all elements*/ display: inline-block; /* Characteristics of block, but sits on a line */ display: block; /* Display block-level element */ display: run-in; /* Not particularly well supported */ display: none; /* Hide */ }

Some Useful Elements - Display Inline Don’t start on a new line and only take up as much width as necessary. It sits right inline with the natural flow of the text. e.g. <span>、<em> 、<b>、<a> Inline Block Similar to inline element but is able to set a width and height Block Don’t sit inline but break past them. Take up as much horizontal space as they can. e.g. <div>、<section>、<ul>、<h1> Run-in Make a header element to sit inline with the text below it. Don’t work in Firefox

Some Useful Elements - Display

Some Useful Elements - Display Table Values Force non-table elements to behave like table-elements Browser Support: IE8 supports the "table-" values only if a !DOCTYPE is specified. div { display: table; /* like a <table> element*/ display: table-cell; /* like a <td> element*/ display: table-column; /* like a <col> element*/ display: table-column-group; /* like a <colgroup> element*/ display: table-header-group; /* like a <thead> element */ display: table-row-group; /* like a <tbody> element*/ display: table-footer-group; /* like a <tfoot> element*/ display: table-row; /*like a <tr> element */ display: table-caption; /* like a <caption> element*/ }

Some Useful Elements - Display

Some Useful Elements - Display Put together a multi-column layout

What is CSS 3.0 ? CSS 3.0 is the latest standard for CSS, and also completely backwards-compatible with earlier versions of CSS.

Border-Radius Property With CSS 3.0, you can give any element "rounded corners", by using the border-radius property. It is normally used like this:

Border-Radius Property Rules: Four values: first value applies to top-left, second value applies to top-right, third value applies to bottom-right, and fourth value applies to bottom-left corner Three values: first value applies to top-left, second value applies to top-right and bottom-left, and third value applies to bottom-right Two values: first value applies to top-left and bottom-right corner, and the second value applies to top-right and bottom-left corner One value: all four corners are rounded equally

Backgrounds CSS 3.0 allows you to add multiple background images for an element, through the background-image property. The different background images are separated by commas, and the images are stacked on top of each other, where the first image is closest to the viewer.

Backgrounds Multiple background images can be specified using either the individual background properties (as above) or the background shorthand property. The background-size property accepts multiple values for background size (using a comma-separated list), when working with multiple backgrounds.

Colors CSS supports color names, hexadecimal and RGB colors. In addition, CSS3 also introduces: RGBA colors, HSL colors, HSLA colors, opacity RGBA Colors an extension of RGB color values with an alpha channel - specifies the opacity for a color.

Colors HSL Colors Hue, Saturation and Lightness. Hue is a degree on the color wheel (0 - 360): 0 (or 360) is red 120 is green 240 is blue Saturation is a percentage value: 100% is the full color. Lightness is also a percentage; 0% is dark (black) and 100% is white.

Colors HSLA Colors Opacity HSLA color values are an extension of HSL color values with an alpha channel - which specifies the opacity for a color. Opacity Opacity property sets the opacity for the whole element (both background color and text will be opaque/transparent). And the opacity property value must be a number between 0.0 (fully transparent) and 1.0 (fully opaque).

Gradients CSS 3.0 gradients let you display smooth transitions between two or more specified colors. CSS3 defines two types of gradients: Linear Gradients (goes down/up/left/right/diagonally) Radial Gradients (defined by their center) Linear Gradients

Gradients Radial Gradients

Shadow Effects The CSS3 text-shadow property applies shadow to text. In its simplest use, you only specify the horizontal shadow (2px) and the vertical shadow (2px): Next, add a color to the shadow: Then, add a blur effect to the shadow:

Text CSS 3.0 contains several new text features: text-overflow word-wrap word-break Text Overflow The CSS3 text-overflow property specifies how overflowed content that is not displayed should be signaled to the user.

Text Word Wrapping Word Breaking The CSS3 word-wrap property allows long words to be able to be broken and wrap onto the next line. Word Breaking The CSS3 word-break property specifies line breaking rules.

Animations CSS 3.0 animations allows animation of most HTML elements without using JavaScript or Flash! What are CSS 3.0 Animations? An animation lets an element gradually change from one style to another. You can change as many CSS properties you want, as many times you want.

Animations To use CSS 3.0 animation, you must first specify some keyframes for the animation. Keyframes hold what styles the element will have at certain times. The @keyframes Rule When you specify CSS styles inside the @keyframes rule, the animation will gradually change from the current style to the new style at certain times.

Resources http://www.w3schools.com/css/ http://www.html.net/tutorials/css/ http://www.barelyfitz.com/screencast/html-training/css/positioning/ https://www.css3maker.com/

Question Time