Cao Yuewen ywcao@se.cuhk.edu.hk 2017.10.12 SEEM4570 Tutorial 03: CSS Cao Yuewen ywcao@se.cuhk.edu.hk 2017.10.12.

Slides:



Advertisements
Similar presentations
Table, List, Blocks, Inline Style
Advertisements

Table (TABLE) Contains TABLE ROWS (TR) Contains TABLE DATA (TD) Data can contain anything Text Lists Other tables Pictures …
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
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
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.
กระบวนวิชา 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.
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.
Creating Tables Text Tables -created by using preformatted tags. Graphical Tables - created using Table Structure with HTML.
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.
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.
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.
CS134 Web Design & Development Cascading Style Sheets (CSS) Mehmud Abliz.
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
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.
Table (TABLE) Contains TABLE ROWS (TR) Contains TABLE DATA (TD) Data can contain anything › Text › Lists › Other tables › Pictures › …
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.
1 © Netskills Quality Internet Training, University of Newcastle Using Style Sheets in Dreamweaver CS © Netskills, Quality Internet Training, University.
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.
CASCADING STYLE SHEET 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.
WebD Introduction to CSS By Manik Rastogi.
CSS.
Laying out Elements with CSS
Working with Cascading Style Sheets
CSS Cascading Style Sheets
CS3220 Web and Internet Programming CSS Basics
4.01 Cascading Style Sheets
( Cascading style sheet )
Webpage layout using CSS
Working with Tables: Module A: Table Basics
Madam Hazwani binti Rahmat
Cascading Style Sheets
Tutorial 5 Working with Tables and Columns
Intro to CSS CS 1150 Fall 2016.
Chapter 7 Tables.
The Internet 10/25/11 XHTML Tables
Cascading Style Sheets
CASCADING STYLE SHEET CSS.
CSS Applications to XML 19-Sep-18.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Website Design 3
Cascading Style Sheets - Building a stylesheet
Intro to CSS CS 1150 Spring 2017.
Styles and the Box Model
Second CSS Lecture Applications to XML
MORE Cascading Style Sheets (The Positioning Model)
Software Engineering for Internet Applications
DynamicHTML Cascading Style Sheet Internet Technology.
CS134 Web Design & Development
For the World Wide Web Styling Tables with CSS
What are Cascading Stylesheets (CSS)?
Cascading Style Sheets™ (CSS)
DynamicHTML Cascading Style Sheet Internet Technology.
SEEM4570 Tutorial 3: CSS + CSS3.0
More CSS 22-Feb-19.
Floating and Positioning
CS3220 Web and Internet Programming CSS Basics
CS3220 Web and Internet Programming CSS Basics
Web Design & Development
Principles of Web Design 5th Edition
Laying out Elements with CSS
Cascading Style Sheets - Building a stylesheet
4.01 Cascading Style Sheets
CSS Applications to XML 20-May-19.
Web Client Side Technologies Raneem Qaddoura
Cascading Style Sheets
CSS Applications to XML 3-Jul-19.
Presentation transcript:

Cao Yuewen ywcao@se.cuhk.edu.hk 2017.10.12 SEEM4570 Tutorial 03: CSS Cao Yuewen ywcao@se.cuhk.edu.hk 2017.10.12

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

Why CSS ? Separates content from form Easy maintenance of multiple pages Faster page loading Easy to learn

Three Ways to Insert CSS Inline: the “style” attribute Internal: the <style> markup tag External: the .css stylesheet file <p style=“font-color:red;font-size:10px;”>Content</p> <html><head><style> p {background-color: Red;font-family: serif;font-color: White; } </style></head><body> <p>Content</p> </body></html> <link rel="stylesheet" type="text/css" href=“mystylesheet.css" />

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>

Class in CSS You can also specify the specific HTML elements should be affected by a class. <head> <style> div.para1{ color:red; } </style> </head> <body> <p class="para1">No effect</p> <div class="para1">Affected</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

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

Question Time