CSS Cascading Style Sheets

Similar documents
CSS Cascading Style Sheets

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

BIM222 Internet Programming

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

Assignments (4) Assessment as per Schedule (2)

CSS: The Basics CISC 282 September 20, 2014

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

Cascading Style Sheets Level 2

Cascading Style Sheets (CSS)

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

Introduction to Web Design CSS Reference

CSS.

Introduction to Web Design CSS Reference

Appendix D CSS Properties and Values

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

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

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

Creating and Building Websites

CSS Styles Quick Reference Guide

Cascading Style Sheets CSCI 311

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

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

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

Make a Website. A complex guide to building a website through continuing the fundamentals of HTML & CSS. Created by Michael Parekh 1

CSS: Cascading Style Sheets

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

Web Engineering CSS. By Assistant Prof Malik M Ali

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

2. Write style rules for how you d like certain elements to look.

Study Guide 2 - HTML and CSS - Chap. 6,8,10,11,12 Name - Alexia Bernardo

Cascade Stylesheets (CSS)

Introduction to Web Tech and Programming

Web Development & Design Foundations with HTML5

CSS: Cascading Style Sheets

HTML/XML. HTML Continued Introduction to CSS

Web Development & Design Foundations with HTML5

Reading 2.2 Cascading Style Sheets

Introduction to Cascading Style Sheets

COMS 359: Interactive Media

IMY 110 Theme 6 Cascading Style Sheets

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

Parashar Technologies HTML Lecture Notes-4

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

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

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

COSC 2206 Internet Tools. CSS Cascading Style Sheets

Controlling Appearance the Old Way

ID1354 Internet Applications

CSC309 Programming on the Web week 3: css, rwd

Introduction to WEB PROGRAMMING

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

CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB

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

ITNP43: HTML Lecture 4

CASCADING STYLESHEETS

WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5

Web Design and Development Tutorial 03

INTRODUCTION TO CSS. Topics MODULE 5

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

CSS Box Model. Cascading Style Sheets

2005 WebGUI Users Conference

Using Dreamweaver CS6

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

DAY 4. Coding External Style Sheets

Cascading Style Sheets

Using Dreamweaver CC. 6 Styles in Websites. Exercise 1 Linked Styles vs Embedded Styles

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

Intermediate Web Publishing: Working with Styles

Index. alt, 38, 57 class, 86, 88, 101, 107 href, 24, 51, 57 id, 86 88, 98 overview, 37. src, 37, 57. backend, WordPress, 146, 148

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

HTML/CSS. HTML review and extra CSS review CSS Color

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

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

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

8a. Cascading Style Sheet


Lab 4 CSS CISC1600, Spring 2012

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

CSS FOUNDATIONS IN-DEPTH. The nitty-gritty of css...

CSS. Lecture 16 COMPSCI 111/111G SS 2018

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

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

In the early days of the Web, designers just had the original 91 HTML tags to work with.

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

Setting a Background Image

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

Building Page Layouts

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

Web Site Design and Development Lecture 5

CSS Lecture 16 COMPSCI 111/111G SS 2018

IDM 221. Web Design I. IDM 221: Web Authoring I 1

Internet Programming 1 ITG 212 / A

Using Advanced Cascading Style Sheets

CMPT 165 Advanced XHTML & CSS Part 3

Web Site Design. Stanford University Continuing Studies CS 03. Mark Branom

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

Deccansoft Software Services

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

3. Each of these mark examples contains an error. a. <input name= country value= Your country here. /> b. <checkbox name= color value= teal />

Transcription:

CSS Cascading Style Sheets

site root index.html about.html services.html stylesheet.css images boris.jpg

Types of CSS External Internal Inline

External CSS An external style sheet is a text document with a.css extension that links to your HTML page from the <head> element. This allows all of your webpages to share the same style sheet. <head> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head>

Internal CSS Embedded styles are found in the <head> of your HTML document. Embedded styles only apply to that one page. <head> <style type= text/css > body { font-family: arial; } </style> </head>

Inline CSS Inline styles are nestled in with the HTML syntax using a style attribute. Inline styles are used to override external style sheets and only apply to that one element. <p>the quick <style= color: red >red</style>fox jumped over the six lazy <style= color: brown >brown</style>dogs.</p>

Selectors and Declarations A CSS rule contains two parts: a selector and a declaration. h1 { font-family: serif; }

Selectors indicate which element the rule applies to. h1 { font-family: serif; }

Declarations indicate how the elements selected are to be styled. They are made up of two parts: property and value. Properties indicate what you want to change. Values specify the settings you want for the property. h1 { font-family: serif; }

You can specify many declarations for each selector, just separate them by a semicolon. h1 { font-family: serif; font-size: 20px; color: pink; }

align font-size src background-color font-style title background-image font-weight text-align There lots of properties border height text-decoration available in css. These cellpadding href text-indent are some of the most frequently used: cellspacing letter-spacing text-transform color margin white-space float name width font padding word-spacing font-family rel

CSS Selectors Universal *{ } Targets all elements on the same page Text h1, h2, h3 { } Targets all the <h1> <h2> <h3> elements Child li>a { } Targets any <a> elements that are children of an <li> element (but not other <a> elements in the page) Descendent p a { } Targets any <a> elements in the <p> element, even if it is not a direct child)

Child div>p { } Descendent div p { }

Naming Elements with an ID or Class To have more control over your css you can name your HTML elements with an ID or Class. Identifiers (ID) are unique names given to an element. A class can be used to name more than one element. Name your <div> with an ID or class within the opening tag of the element: <div id= sidebar > </div> <div class= left-column > </div>

In your CSS document, ID selectors begin with a hashtag, and class selectors begin with a period: ID html <div id= sidebar > </div> css #sidebar { float: left; } Class html <div class= left-column > </div> css.left-column { float: left; }

Color RGB h1 { color: rgb(140,200,238); } RGBa h1 { color: rgba(140,200,238,0.5); } Color h1 { color: red; } HEX h1 { color: #ff3344; }

font-family The font-family property allows you to specify a typeface. p { font-family: Georgia, Times, serif; } You can specify a list of fonts separated by commas so that if the user does not have your first choice typeface installed, the browser can try to use an alternative font from the list.

Google Fonts For more type options, go to fonts.google.com. Click on the font family you wish to use. Then click on Select This Font. A panel should popup, copy/paste the first line of code into the <head> of your HTML document. It should look like this: <link href= https://fonts.googleapis.com/ css?family=roboto rel= stylesheet > Then copy the provided CSS from the same Google popup panel and paste it into your external CSS document. This will be your font-family for whatever HTML element you wish to style. Here is an example: body { font-family: Roboto, sans-serif;}

font-size There are several ways to specify the size of a font. pixels px 1 px = 1 pt percentages % 100% = 16px (default size of body text in the browser all percentages are in relation to 16px) ems em 1em = 16px (default size of body text in the browser all ems are in relation to parent s font size)

Formatting Link States normal, unvisited link link the user has visited link when the user mouses over it link the moment it is clicked a:link { color: red; } a:visited { color: orange; } a:hover { color:yellow; } a:active { color: purple; } Note: Must be in this order!

Text Properties color font-family font-size font-weight font-style text-transform text-decoration text-align text-indent text-shadow line-height letter-spacing word-spacing vertical-align

margin border padding Box Model When setting heights and widths for an element in CSS you must take into account accurate measurements for all your boxes properties (i.e. padding, margins, etc). This is the content that is contained within the box. This applies to text and images..column { width: 300px; padding: 10px; margin: 20px; border: 5px solid green; } Total Width of Box= 370px

Box Dimensions When using percentages, the size of the box is relative to the size of the browser window, or if the box is encased within another box, it is a percentage of the size of the containing box. When using ems, the size of the box is based on the the size of the text that it sits inside of.

border properties border border-style must be defined for the border to appear: border-top border-right border-bottom border-left border-size border-style border-height dotted dashed solid double groove ridge inset outset none hidden border-width You can also use shorthand for the different properties. border: 5px solid red;

margin and padding properties margin margin-top margin-right margin-bottom margin-left padding padding-top padding-right padding-bottom padding-left You can also use shorthand for the different properties. margin: 25px 50px 75px 100px;