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

Similar documents
CSS stands for Cascading Style Sheets Styles define how to display HTML elements

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

INFORMATICA GENERALE 2014/2015 LINGUAGGI DI MARKUP CSS

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

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

Unit 6. Lesson 6.1. Cascading Style Sheets. Introduction. Overview of Cascading Style Sheets. Why CSS. What is CSS?

Cascading style sheets, HTML, DOM and Javascript

BIM222 Internet Programming

CASCADING STYLE SHEET CSS

Parashar Technologies HTML Lecture Notes-4

Assignments (4) Assessment as per Schedule (2)

CSS Cascading Style Sheets

What is CSS? NAME: INSERT OPENING GRAPHIC HERE:

Lab 4 CSS CISC1600, Spring 2012

Web Engineering CSS. By Assistant Prof Malik M Ali

Three Ways to Use CSS:

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

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

PENGENALAN CSS. A. Pendahuluan

7300 Warden Avenue, Suite 503 Markham, Ontario Canada L3R 9Z6. Phone: Toll Free: Fax:

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

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

Programmazione Web a.a. 2017/2018 HTML5

IMY 110 Theme 6 Cascading Style Sheets

Module 2 (VI): CSS [Part 3]

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

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

COSC 2206 Internet Tools. CSS Cascading Style Sheets

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

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

Chapter 2 CSS for Style

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

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

CREATING A WEBSITE USING CSS. Mrs. Procopio CTEC6 MYP1

Appendix D CSS Properties and Values

CSS Introduction. What is CSS? Styles Solved a Big Problem. CSS Saves a Lot of Work! What You Should Already Know KKCC INFO SYSTEMS.

The default style for an unordered (bulleted) list is the bullet, or dot. You can change the style to either a square or a circle as follows:

Cascading Style Sheets (CSS)

Using Dreamweaver CS6

ID1354 Internet Applications

Adding CSS to your HTML

HTML/XML. HTML Continued Introduction to CSS

Introduction to Web Tech and Programming

CSS.

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

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

CSS: Cascading Style Sheets

Block & Inline Elements

CSE 154 LECTURE 3: MORE CSS

ADDING CSS TO YOUR HTML DOCUMENT. A FEW CSS VALUES (colour, size and the box model)

Making our HTML Look Nicer Cascading Style Sheets Chapter 2

Web Design and Development Tutorial 03

Anatomy of a Style. Cascaded Style Sheets - CSS. CSS Presentation Description Language. Measurement Specification

Cascading Style Sheets. Overview and Basic use of CSS

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

Introduction to using HTML to design webpages

Basic CSS Lecture 17

8a. Cascading Style Sheet

With HTML you can create your own Web site. This tutorial teaches you everything about HTML.

CSS

Cascade Stylesheets (CSS)

Fundamentals of Web Technologies. Agenda: HTML Links 5/22/2017. HTML Links - Hyperlinks HTML Lists

WEB TECHNOLOGIES. UNIT II introduction to the style sheets and java script. 4. Cascading Stylesheets. 5. An Introduction to Java Script

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

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

HTML & CSS Cheat Sheet

DAY 4. Coding External Style Sheets

Creating and Building Websites

Module 2 (VII): CSS [Part 4]

CSS Scripting and Computer Environment - Lecture 09

AN INTRODUCTION TO WEB PROGRAMMING. Dr. Hossein Hakimzadeh Department of Computer and Information Sciences Indiana University South Bend, IN

CS 350 Internet Applications I Name: Exam II (CSS) October 29, 2013

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

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

Zen Garden. CSS Zen Garden

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

CSS: formatting webpages

CSS: The Basics CISC 282 September 20, 2014

CSS Weebly! td{ padding:20px}

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

Chapter 1 Getting Started with HTML 5 1. Chapter 2 Introduction to New Elements in HTML 5 21

HTML Text Formatting. HTML Session 2 2

Using Dreamweaver. 6 Styles in Websites. 1. Linked or Imported Stylesheets. 2. Embedded Styles. 3. Inline Styles

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

Cascading Style Sheet Quick Reference

Cascading Style Sheets

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

CMPT 165 Advanced XHTML & CSS Part 3

Web Information System Design No.4 Put Style to Web Documents. Tatsuya Hagino

Unveiling the Basics of CSS and how it relates to the DataFlex Web Framework

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

Setting a Background Image

By Ryan Stevenson. Guidebook #3 CSS

Reading 2.2 Cascading Style Sheets

CSS Cascading Style Sheets

COMP519 Web Programming Lecture 6: Cascading Style Sheets: Part 2 Handouts

Cascading Style Sheets Level 2

recall: a Web page is a text document that contains additional formatting information in the HyperText Markup Language (HTML)

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

Introduction to Web Programming and Design

Transcription:

CSS M hiwa ahamad aziz www.raparinweb.fulba.com Raparin univercity 1

What is 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 External Style Sheets can save a lot of work Completely restyle a web site with only a few changes to your CSS code External Style Sheets are stored in CSS files 2 Of 21

HTML has evolved a *lot* over the years - as computers and networks have gotten faster. 1995 3 Of 21 2007 Source: www.yahoo.com

CSS Syntax A CSS rule has two main parts: a selector, and one or more declarations: The selector is normally the HTML element you want to style. Each declaration consists of a property and a value. The property is the style attribute you want to change. Each property has a value. 4 Of 21

CSS Syntax A CSS declaration always ends with a semicolon declaration groups are surrounded by curly brackets: p {color:red;text-align:center;} To make the CSS more readable, you can put one declaration on each line, like this: p { color:red; text-align:center; } 5 Of 21

CSS Syntax CSS Comments A CSS comment begins with "/*", and ends with "*/", like this: p { } text-align:center; /*This is another comment*/ color:black; font-family:arial; 6 Of 21

CSS Id and Class CSS allows to specify selectors called "id" and "class". 7 Of 21

Id Selector The id selector is used to specify a style for a single, unique element. The id selector uses the id attribute of the HTML element, and is defined with a "#". #para1 { text-align:center; color:red; } <p id= para1 > sample text</p> 8 Of 21

Class Selector The class selector is used to specify a style for a group of elements. This allows to set a particular style for many HTML elements with the same class. The class selector uses the HTML class attribute, and is defined with a ".".center {text-align:center;} <p class= center > sample text1</p> <p class= center > sample text2</p> 9 Of 21

Class Selector all p elements with class="center" will be centeraligned p.center {text-align:center;} Do NOT start a class name with a number 10 Of 21

CSS How To... Three Ways to Insert CSS External style sheet Internal style sheet Inline style 11 Of 21

External Style Sheet Is ideal when the style is applied to many pages. You can change the look of an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section <head> <link href="mystyle.css" rel="stylesheet" type="text/css" /> </head> 12 Of 21

External Style Sheet An external style sheet can be written in any text editor. The file should not contain any html tags. External style sheet should be saved with a.css extension. An example: hr {color:sienna;} p {margin-left:20px;} body {background-image:url("images/back40.gif");} 13 Of 21

Internal Style Sheet An internal style sheet should be used when a single document has a unique style. Define internal styles in the head section of an HTML page, by using the <style> tag An example: <head> <style type="text/css"> hr {color:sienna;} p {margin-left:20px;} body {background-image:url("images/back40.gif");} </style> </head> 14 Of 21

Inline Styles Inline style loses many of the advantages of style sheets by mixing content with presentation. Use this method sparingly! To use inline styles use the style attribute in the relevant tag. The style attribute can contain any CSS property. An example: <p style="color:sienna;margin-left:20px;">this is a paragraph.</p> 15 Of 21

CSS Background CSS properties used for background effects: background-color: specifies the background color of an element body {background-color:#b0c4de;} background-image: specifies an image to use as the background body {background-image:url('paper.gif');} background-repeat: images can be repeated only horizontally or vertically, or they will look strange body {background-repeat:repeat-x; } body {background-repeat:no-repeat; } background-position: Specifies the position of the image body {background-position:right top; } 16 Of 21

CSS Text Text Color body {color:blue;} h1, h2,p {color:#00ff00;} Text Alignment h1 {text-align:center;} p.date {text-align:right;} Text Decoration a {text-decoration:none;} h1 {text-decoration:overline;} h2 {text-decoration:line-through;} h3 {text-decoration:underline;} h4 {text-decoration:blink;} remove underlines from links 17 Of 21

CSS Text Text Transformation It can be used to turn everything into uppercase or lowercase letters p.uppercase {text-transform:uppercase;} p.lowercase {text-transform:lowercase;} Text Indentation specify the indentation of the first line of a text p {text-indent:50px;} 18 Of 21

CSS Font Font Family: is set with the font property p{font-family:"times New Roman", Times, serif;} Font Style: is mostly used to specify italic text p.normal {font-style:normal;} p.italic {font-style:italic;} Font Size: Sets the size of the text. h1 {font-size:40px;} 19 Of 21

CSS Links Links can be styled with any CSS property (e.g. color, fontfamily, background, etc.). The four links states are: Example a:link - a normal, unvisited link a:visited - a link the user has visited a:hover - a link when the user mouses over it a:active - a link the moment it is clicked a:link {color:#ff0000; text-decoration:none;} /* unvisited link */ a:visited {color:#00ff00; background-color:#b2ff99;} /* visited link */ a:hover {color:#ff00ff;} /* mouse over link */ a:active {color:#0000ff;} /* selected link */ 20 Of 21

CSS Lists The CSS list properties allow you to: Set different list item markers for ordered lists ol.c {list-style-type: upper-roman;} ol.d {list-style-type: lower-alpha;} Set different list item markers for unordered lists ul.a {list-style-type: circle;} ul.b {list-style-type: square;} Set an image as the list item marker ul { list-style-image: url('sqpurple.gif'); } 21 Of 21

Table Borders 22 Of 21 CSS Tables table {border: 1px solid black;} Table Width and Height table { width:100%;} th{ height:50px; } Table Text Alignment Table Padding Table Color td{text-align:right; vertical-align:bottom;} td{padding:15px;} table, td, th{border:1px solid green;} th{background-color:green;color:white;}

23 Of 21 Source: http://www.lesliefranke.com/files/reference/csscheatsheet.html

Two kinds of elements Inline - affects how text looks strong, span, a,input,etc Block affects Whole of line Paragraphs, div, h1 - h6, p, div, blockquote, ul, ol, form,etc CSS can change a tag from inline to block #navigation li { display: inline; inline-block; Width : 20px; } 24 Of 21

CSS Box Model height and width properties size the block element margin properties define the space around the block element border properties define the borders around a a block element padding properties define the space between the element border and the element content background properties allow you to control the background color of an element, set an image as the background, repeat a background image vertically or horizontally, and position an image on a page 25 Of 21 http://reference.sitepoint.com/css/boxmodel

.trapped { height: 100px; width: 200px; margin: 20px; border: 5px solid yellow; background:red; padding: 20px; font-family:arial; color:orange; font-size:20px; } <p class= trapped > I am trapped in a glass case of emotion which is 100px high and 200px wide. </p> The Box Model 1 9 0 1 5 0 20 1 4 0 1 0 0 5 20 26 Of 21

.trapped { height: 80px; width: 50px; }.trapped2 { height: 80px; width: 50px; border: 5px solid yellow; padding: 10px; } <p class="trapped"> One</p> <p class="trapped2"> Two</p> 27 Of 21 Border, padding, and margin are additive.

Position and visibility Position can have be Relative... Position compared to parent Absolute --- Position compared to Beginning page Fixed --- Position compared to Beginning page visibility can have be Hidden visibility 28 Of 21

Position and visibility <head> <style> div.relative { position: relative; width: 400px; height: 200px; border: 3px solid #73AD21; } div.absolute { position: absolute; top: 80px; right: 0; width: 200px; height: 100px; border: 3px solid #73AD21; } </style> </head> <body> <h2>position: absolute;</h2> output <div class="relative">this div element has position: relative; </div> <div class="absolute">this div element has position: absolute;</div> </body> </html 29 Of 21

Display and overflew Display: Specifies how an element should be displayed -inline :An inline element does not start on a new line and only takes up as much width as necessary. Examples : <span>, <a> <img> -inline-block : this case with width be block. -block : An block element start on a new line. -none : nothing display. Overflow : Clip the top/bottom edges of the content inside the <div> element - if it overflows the element's content area: Hidden : The content is clipped - and no scrolling mechanism is provided. Scroll : The content is clipped and a scrolling mechanism is provided Visible : The content is not clipped, and it may be rendered outside the content box 30 Of 21

Display <head> <style> li { display: inline; } </style> </head> <body> <p>display a list of links as a horizontal menu:</p> <ul> <li><a href="/html/default.asp" target="_blank">html</a></li> <li><a href="/css/default.asp" target="_blank">css</a></li> <li><a href="/js/default.asp" target="_blank">javascript</a></li> </ul> </body> </html> Output Display a list of links as a horizontal menu: HTML CSS JavaScript 31 Of 21

overflew <style> div.scroll { width: 100px; overflow: scroll; } div.hidden { width: 100px; overflow: hidden; } </style> <body> <p>overflow:scroll</p> background-color: #00FFFF; height: 100px; background-color: #00FF00; height: 100px; <div class="scroll">you can use the overflow property when you want to have better control of the layout. The default value is visible.</div> <p>overflow:hidden</p> <div class="hidden">you can use the overflow property when you want to have better control of the layout. The default value is visible.</div> </body> output 32 Of 21