Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS. 8 Oct 2015

Similar documents
CSS Cascading Style Sheets

Appendix D CSS Properties and Values

Adding CSS to your HTML

IMY 110 Theme 6 Cascading Style Sheets

Introduction to Web Design CSS Reference

CSS Styles Quick Reference Guide

Introduction to Web Design CSS Reference

Web Engineering CSS. By Assistant Prof Malik M Ali

Introduction to Web Tech and Programming

Reading 2.2 Cascading Style Sheets

Introduction to Multimedia. MMP100 Spring 2016 thiserichagan.com/mmp100

CSS Selectors. element selectors. .class selectors. #id selectors

COSC 2206 Internet Tools. CSS Cascading Style Sheets

HTML/XML. HTML Continued Introduction to CSS

Assignments (4) Assessment as per Schedule (2)

CSS مفاهیم ساختار و اصول استفاده و به کارگیری

CASCADING STYLESHEETS

Cascading Style Sheets

Wanted! Introduction. Step 1: Styling your poster. Activity Checklist. In this project, you ll learn how to make your own poster.

BIM222 Internet Programming

DAY 4. Coding External Style Sheets


2005 WebGUI Users Conference

<body bgcolor=" " fgcolor=" " link=" " vlink=" " alink=" "> These body attributes have now been deprecated, and should not be used in XHTML.

3.1 Introduction. 3.2 Levels of Style Sheets. - The CSS1 specification was developed in There are three levels of style sheets

- The CSS1 specification was developed in CSS2 was released in CSS2.1 reflects browser implementations

Parashar Technologies HTML Lecture Notes-4

INTERNATIONAL UNIVERSITY OF JAPAN Public Management and Policy Analysis Program Graduate School of International Relations

CSS. Lecture 16 COMPSCI 111/111G SS 2018

Cascading Style Sheets (CSS)

UNIVERSITI TEKNOLOGI MALAYSIA TEST 1 SEMESTER II 2012/2013

- The CSS1 specification was developed in CSSs provide the means to control and change presentation of HTML documents

HTML Summary. All of the following are containers. Structure. Italics Bold. Line Break. Horizontal Rule. Non-break (hard) space.

Cascading Style Sheet Quick Reference

CSS Lecture 16 COMPSCI 111/111G SS 2018

CSS: Layout Part 2. clear. CSS for layout and formatting: clear

Cascade Stylesheets (CSS)

Page Layout. 4.1 Styling Page Sections 4.2 Introduction to Layout 4.3 Floating Elements 4.4 Sizing and Positioning

CSS: Lists, Tables and the Box Model

8/19/2018. Web Development & Design Foundations with HTML5. Learning Objectives (1 of 2) Learning Objectives (2 of 2)

Welcome Please sit on alternating rows. powered by lucid & no.dots.nl/student

Controlling Appearance the Old Way

Creating A Website - Part 1: Web Design principles, HTML & CSS. CSS Color Values. Hexadecimal Colors. RGB Color

Lecture 10. CSS Properties. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

GIMP WEB 2.0 MENUS WEB 2.0 MENUS: HORIZONTAL NAVIGATION BAR CREATING AN HTML LIST

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

More CSS. <link href="filename" type="text/css" rel="stylesheet" /> CS380

CSS: The Basics CISC 282 September 20, 2014

1 of 7 11/12/2009 9:29 AM

Cascading Style Sheet. Styles as Tag Attributes. Syntax. <h1>: what font type/size is used? STYLE = SELECTOR {RULES} Attributes such as bgcolor

HTML & CSS. SWE 432, Fall 2017 Design and Implementation of Software for the Web

CSS.

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 3 Introduction to CSS

CSS Box Model. Cascading Style Sheets

3.1 Introduction. 3.2 Levels of Style Sheets. - HTML is primarily concerned with content, rather than style. - There are three levels of style sheets

Review Question 1. Which tag is used to create a link to another page? 1. <p> 2. <li> 3. <a> 4. <em>

The building block of a CSS stylesheet. A rule consists of a selector and a declaration block (one or more declarations).

**Method 3** By attaching a style sheet to your web page, and then placing all your styles in that new style sheet.

Chapter 2 CSS for Style

Cascading Style Sheets CSCI 311

CSS. M hiwa ahamad aziz Raparin univercity. 1 Web Design: Lecturer ( m hiwa ahmad aziz)

Session 3.1 Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external style sheets Understand style

Session 4. Style Sheets (CSS) Reading & References. A reference containing tables of CSS properties

CSS CSS how to display to solve a problem External Style Sheets CSS files CSS Syntax

Web Design and Development Tutorial 03

- HTML is primarily concerned with content, rather than style. - However, tags have presentation properties, for which browsers have default values

APPLIED COMPUTING 1P01 Fluency with Technology

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model

Unit 10 - Client Side Customisation of Web Pages. Week 5 Lesson 1 CSS - Selectors

escuela técnica superior de ingeniería informática

Cascading Style Sheets. Overview and Basic use of CSS

GIMP WEB 2.0 MENUS. Web 2.0 Menus: Horizontal Navigation Bar with Dynamic Background Image

View all articles by Kevin Verdana, Tahoma, etc.) for the main body text of a site.

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS

Introduction to Cascading Style Sheets

Unit 20 - Client Side Customisation of Web Pages. Week 2 Lesson 4 The Box Model

ICT IGCSE Practical Revision Presentation Web Authoring

Comp-206 : Introduction to Software Systems Lecture 23. Alexandre Denault Computer Science McGill University Fall 2006

Web Development & Design Foundations with HTML5

<style type="text/css"> <!-- body {font-family: Verdana, Arial, sans-serif} ***set font family for entire Web page***

CSS: Cascading Style Sheets

CSS Cascading Style Sheets

Module 2 (VII): CSS [Part 4]

ID1354 Internet Applications

Web Development & Design Foundations with HTML5

LBS Polytechnic. Hey! Make With The Style Sheet Already, Bub!

KillTest *KIJGT 3WCNKV[ $GVVGT 5GTXKEG Q&A NZZV ]]] QORRZKYZ IUS =K ULLKX LXKK [VJGZK YKX\OIK LUX UTK _KGX

The most important layout aspects that can be done with tables are:

Deccansoft Software Services

CSS Tutorial Part 1: Introduction: A. Adding Style to a Web Page (3 options):

CSC309 Programming on the Web week 3: css, rwd

Introduction to WEB PROGRAMMING

By Ryan Stevenson. Guidebook #3 CSS

Fundamentals of Web Programming a

Building Page Layouts

Tutorial 3: Working with Cascading Style Sheets

CSS: Formatting Text. CSS for text processing: font-family. Robert A. Fulkerson

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

CSS means Cascading Style Sheets. It is used to style HTML documents.

INFS 2150 Introduction to Web Development

Transcription:

Networks and Web for Health Informatics (HINF 6220) Tutorial 8 : CSS 8 Oct 2015

What is CSS? o CSS (Style Sheet) defines how HTML elements are formatted and displayed. o It helps you easily change an HTML page format without substantial HTML code changes. o The style of each element is defined using a set of property values. As an example, a blue DIV with medium sized text has the following CSS properties: This is my text. Property background-color Value blue font-size 12px

CSS Syntax o The standard syntax of CSS includes an element identifier (selector) and set of properties values in brackets: div { background-color : blue; font-size : 12px; Element identifier (selector) 1 st Property - Value 2 nd Property - Value This is my text. Property background-color font-size Value blue 12px

CSS Syntax CSS rules can be added to the HTML document in three ways: 1 Inline with other HTML code. In this case, the syntax is slightly different: use the tag attribute style. <div style = background-color : blue; font-size : 12px; > </div> Downside: The HTML file have to be edited for each format change; Much repetition and complexity in CSS rules.

CSS Syntax CSS rules can be added to the HTML document in three ways: 2 Internal Style Sheet. CSS rules are placed in the <style> tag inside the <head> section. <head> </head> <style> div { background-color : blue; font-size : 12px; </style>

CSS Syntax CSS rules can be added to the HTML document in three ways: 3 External Style Sheet. CSS rules are placed in a separate file outside of the HTML file. The CSS file is referenced inside the <head> section of the HTML file. <head> </head> mystyle.css <link rel= stylesheet type= text/css href= mystyle.css > This standard part never changes div { background-color : blue; font-size : 12px; Change this to your file name

CSS Syntax Selectors CSS Selectors identify which page elements the set of CSS rules apply to. Select by element Select by HTML ID Select by CSS Class div { background-color : blue; font-size : 12px; o This rule is assigned to all DIV elements. #mydiv { background-color : blue; font-size : 12px; o ID is specified with # o Use the specified ID in HTML attribute: <div id= mydiv > </div>.mycssclass { background-color : blue; font-size : 12px; o Class is defined by dot(.) o Use the specified class in HTML attribute: <div class= mycssclass > </div>

CSS Syntax Selectors CSS selectors can be combined in certain ways: div#mydiv { color : blue.my1class,.my2class { color : blue.my1class.my2class { color : blue.my1class.my2class { color : blue o The Div element that has the id=mydiv: o All elements with class my1class or my2class. o All elements with class my1class and my2class. o All elements with class my2class that are inside elements with class my1class. <div id= mydiv ></div> <div id= mydiv2 ></div> <p class= my1class ></p> <div class= my2class ></div> <p class= my1class my2class ></p> <div class= my2class ></div> <div class= my1class > <p class= my2class ></p> </div>

CSS Syntax Selectors To specify styles for different states of an element, add standard states after the selector: a:link { color : blue o Style of links before being visited. This is my link a:hover { color : red a:visited { color : green o Style of links when mouse is hold over. o Style of links when visited. This is my link This is my link

CSS Color The color value for different CSS properties (e.g. text color) can be specified using: o English name o RGB numbers o HEX numbers div { background-color : Yellow; div { background-color : rgb(255, 255, 0); div { background-color : #FFFF00; To correctly find the desired color codes in HEX or RGB, use color charts: www.w3schools.com/tags/ref_colorpicker.asp

CSS Text o Text color: o Text alignment: o Text decoration: color : black / rgb(0,0,0) / #000000; text-align : center / right / justify; text-decoration : overline / line-through / underline; o Text transformation: text-transform : uppercase / lowercase / capitalize; o Font family: o Font size: o Font style: o Unordered list: font-family : "Times New Roman"; font-size : 12px / 12pt / 1.5em; font-style : normal / italic; list-style-type : circle / square;

Element Box An HTML element box around it is separated into three different areas: Margin: An area outside HTML element after the element border. An HTML Element e.g. <p> Border: The border around an HTML element. Padding: An area inside HTML element between the content (e.g. text) and the element border.

Element Box Border o Border color: o Border width: border-color : black / rgb(0,0,0) / #000000; border-width : 2px; o Border style: border-style : none / dotted / hidden / outset / inset / ridge / groove / double / solid / dashed; none is no border and hidden is hidden border. o Apply separately: o Apply all together: border-top-style : dotted; border-right-width : 5px; border : 2px solid black; To find the effect of these values: http://www.w3schools.com/cssref/pr_border-style.asp

Element Box Padding and Margin o Padding: o Padding all together: padding-left : 3px; padding-right : 3px; padding-top : 3px; padding-bottom : 3px; padding : 3px 2px 3px 2px; (top) (right) (bottom) (left) padding : 3px 2px; (top and bottom) (right and left) o Margin style is similar to padding. But they produce different results: padding-left : 5px; padding-top : 5px; margin-right : 10px; border: 2px solid yellow; 5px Text inside element 10px Another element

CSS Example Styling Tables table { table, td, th { border-collapse: collapse; font: 1.2em "Arial"; width: 100%; border: 2px solid black; padding-bottom: 3px; padding-top: 3px; td { padding-left: 7px; td.center { td.itl { padding-left: 0px; text-align: center; font-style: italic; th { background-color: #5C5B58; color: white; th.lowwidth { width: 35%; th.xlowwidth { width: 10%; tr.alt { tr.highlight { background-color: #FBF2D9; background-color: rgb(255, 153, 153);

CSS Example Styling Tables <table> <tr> <th class="xlowwidth">id</th> <th class="lowwidth">firstname</th> <th>lastname</th> </tr> <tr> <td class="center itl">1</td> <td>peter</td> <td>girard</td> </tr> <tr class="alt"> <td class="center itl">2</td> <td>lois</td> <td>bergeron</td> </tr> <tr> <td class="center itl">3</td> <td>john</td> <td>roy</td> </tr> <tr class="alt"> <td class="center itl">4</td> <td>mike</td> <td>williams</td> </tr> <tr class="highlight"> <td class="center itl">count</td> <td colspan="2" >4</td> </tr> </table>