CSS - Cascading Style Sheets



Similar documents
Outline of CSS: Cascading Style Sheets

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

What is CSS? Official W3C standard for controlling presentation Style sheets rely on underlying markup structure

Web Design with CSS and CSS3. Dr. Jan Stelovsky

Web Design and Databases WD: Class 7: HTML and CSS Part 3

{color:blue; font-size: 12px;}

Using Style Sheets for Consistency

CST 150 Web Design I CSS Review - In-Class Lab

ITNP43: HTML Lecture 4

Web layout guidelines for daughter sites of Scotland s Environment

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

Style & Layout in the web: CSS and Bootstrap

CSS 101. CSS CODE The code in a style sheet is made up of rules of the following types

Chapter 7 Page Layout Basics Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Website Development. 2 Text. 2.1 Fonts. Terry Marris September We see how to format text and separate structure from content.

Introduction to Adobe Dreamweaver CC

Cascading Style Sheets (CSS)

CREATING A NEWSLETTER IN ADOBE DREAMWEAVER CS5 (step-by-step directions)

Further web design: Cascading Style Sheets Practical workbook

Web Building Blocks. Joseph Gilbert User Experience Web Developer University of Virginia Library

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

Create Webpages using HTML and CSS

Using an external style sheet with Dreamweaver (CS6)

Development Perspective: DIV and CSS HTML layout. Web Design. Lesson 2. Development Perspective: DIV/CSS

Web Authoring CSS. Module Descriptor

Last week we talked about creating your own tags: div tags and span tags. A div tag goes around other tags, e.g.,:

Creating a Resume Webpage with

Web Design and Development ACS Chapter 9. Page Structure

CREATING HORIZONTAL NAVIGATION BAR USING ADOBE DREAMWEAVER CS5

CSS. CSS - cascading style sheets CSS - permite separar num documento HTML o conteúdo do estilo. ADI css 1/28

Responsive Web Design: Media Types/Media Queries/Fluid Images

ICE: HTML, CSS, and Validation

JJY s Joomla 1.5 Template Design Tutorial:

How To Create A Web Page On A Windows (For Free) With A Notepad) On A Macintosh (For A Freebie) Or Macintosh Web Browser (For Cheap) On Your Computer Or Macbook (

Web Design I. Spring 2009 Kevin Cole Gallaudet University

Coding Standards for Web Development

Cascading Style Sheet (CSS) Tutorial Using Notepad. Step by step instructions with full color screen shots

Create Your own Company s Design Theme

CSS Techniques: Scrolling gradient over a fixed background

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

COMP519 Web Programming Autumn Cascading Style Sheets

HTML5 and CSS3 Design with CSS Page 1

Web Design Revision. AQA AS-Level Computing COMP2. 39 minutes. 39 marks. Page 1 of 17

CSS for Page Layout. Key Concepts

CHAPTER 10. When you complete this chapter, you will be able to:

Basics of HTML (some repetition) Cascading Style Sheets (some repetition) Web Design

Garfield Public Schools Fine & Practical Arts Curriculum Web Design

Selectors in Action LESSON 3

HTML, CSS, XML, and XSL

Web Design & Development - Tutorial 04

CIS 467/602-01: Data Visualization

Essential HTML & CSS for WordPress. Mark Raymond Luminys, Inc mraymond@luminys.com

Web Design for Print Designers WEB DESIGN FOR PRINT DESIGNERS: WEEK 6

Web Development 1 A4 Project Description Web Architecture

How to code, test, and validate a web page

HTML5 and CSS3 Part 1: Using HTML and CSS to Create a Website Layout

How to Properly Compose HTML Code : 1

Embedding a Data View dynamic report into an existing web-page

Creating Web Pages with Dreamweaver CS 6 and CSS

USD WEB SERVICES ADOBE DREAMWEAVER CSS DEVELOPMENT

Contents. Downloading the Data Files Centering Page Elements... 6

Website Login Integration

How to Display Weather Data on a Web Page

In this tutorial, you learn how to create a new view master page and create a new view content page based on the master page.

Responsive Design

Designing HTML s for Use in the Advanced Editor

Table of Contents THE DESIGNER S GUIDE TO CREATING NEWZAPP DRAG AND DROP TEMPLATES... 6 THE NEWZAPP SYSTEM... 7

Interactive Data Visualization for the Web Scott Murray

2nd Edition. #1 Book for SQL*Plus Solutions & Syntax. Oracle Database 10g. Updated for. Oracle SQL*Plus. The Definitive Guide.

How to use SSO with SharePoint 2010 (FBA) using subdomains. Moataz Esmat EXT.1386

A send-a-friend application with ASP Smart Mailer

EUROPEAN COMPUTER DRIVING LICENCE / INTERNATIONAL COMPUTER DRIVING LICENCE WEB EDITING

Advanced Editor User s Guide

MCH Strategic Data Best Practices Review

WEB PROGRAMMING LAB (Common to CSE & IT)

Cascading Style Sheets

Chapter 8 More on Links, Layout, and Mobile Key Concepts. Copyright 2013 Terry Ann Morris, Ed.D

Introduction to Web Design Curriculum Sample

Adobe Illustrator CS6. Illustrating Innovative Web Design

SmilingShops.com Blog hinzufügen für plentymarkets Shopsysteme.

Campaign Guidelines and Best Practices

Magento Responsive Theme Design

BlueHornet Whitepaper

Creating a Web Page Using HTML, XHTML, and CSS: The Basics

Quick Start Guide. This guide will help you get started with Kentico CMS for ASP.NET. It answers these questions:

Transcription:

CSS - Cascading Style Sheets From http://www.csstutorial.net/ http://www.w3schools.com/css/default.asp What is CSS? CSS stands for Cascading Style Sheets Styles define how to display HTML elements External Style Sheets can save a lot of work External Style Sheets are stored in CSS files Syntax A CSS rule has two main parts: a selector, and one or more declarations: The 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 "#". The style rule below will be applied to the element with id="para1": #para1 {

text-align:center; color:red; The class Selector The class selector is used to specify a style for a group of elements. Unlike the id selector, the class selector is most often used on several elements. This allows you 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 "." In the example below, all HTML elements with class="center" will be center-aligned:.center {text-align:center; You can also specify that only specific HTML elements should be affected by a class. In the example below, all p elements with class="center" will be center-aligned: p.center {text-align:center; Example File mycss.css /* Generic Selectors */ body { font-family: Georgia, "Times New Roman", Times, serif; font-size: 14px; color: #333333;

background-color: #F9F9F9; p { width: 80%; li { list-style-type: none; line-height: 150%; list-style-image: url(../images/arrowsmall.gif); h1 { font-family: Georgia, "Times New Roman", Times, serif; font-size: 18px; color: #000000; h2 { font-family: Georgia, "Times New Roman", Times, serif; font-size: 16px; color: #000000; border-bottom: 1px solid #C6EC8C; /**************** Pseudo classes ****************/ a:link { color: #00CC00; text-decoration: underline; li :link { color: #00CC00; text-decoration: none; a:visited {

color: #00CC00; text-decoration: underline; li a:visited { color: #00CC00; text-decoration: none; a:hover { color: rgb(0, 96, 255); padding-bottom: 5px; text-decoration: underline; li a:hover { display: block; color: rgb(0, 96, 255); padding-bottom: 5px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #C6EC8C; a:active { color: rgb(255, 0, 102); /************************* ID's *************************/ #navigation { position: absolute; width: 210px; height: 600px; margin: 0; margin-top: 50px; border-right: 1px solid #C6EC8C; font-weight: normal;

#centerdoc { position: absolute; padding: 0 0 20px 0; /*top right bottom left*/ margin-top: 50px; margin-left: 235px; --------------------------------------------------------------------------------------------------------------- Between the <head> </head> tags: <title>first CSS Tutorial</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <link href="mycss.css" rel="stylesheet" type="text/css"> Between the <body></body> tags: <div id="navigation"> <h2>the Main navigation</h2> </div> <div id="centerdoc"> <h1>the Main Heading</h1> <p>go to the Web Designers Killer Handbook home page and grab the practice HTML page that we will used as the starting template for this tutorial. You can find it under the heading: 'To create the practice HTML page do the following:'. </p> <p>follow the instructions there and create your basic HTML page... and do it now! </p> </div>

<div> tags are designed to be used to create a division in the document or in other words create a container. The CSS Box Model CSS has this feature and concept of a box model that essentially is a box that wraps around HTML elements. This box model consists of: padding, margins, borders and the actual content. This allows us to place a border around elements and space elements in relation to other elements. The image below illustrates the box model: Explanation of the different parts: Margin - Clears an area around the border. The margin does not have a background color, it is completely transparent Border - A border that goes around the padding and content. The border is affected by the background color of the box

Padding - Clears an area around the content. The padding is affected by the background color of the box Content - The content of the box, where text and images appear So in our case anything in between our <div> tags is the content. Right after that comes the padding. Then there is a border and finally a margin. Margin and padding may seem like the same thing but if you think about it, you can see how being able to control the space before the border (padding) and after the border (margins) can really effect your layouts. #navigation { /*a comment*/ position: absolute; width: 210px; height: 600px; margin: 0; margin-top: 0px; border-right: 1px solid #C6EC8C; font-weight: normal; #centerdoc { position: absolute; padding: 0 0 20px 0; /*top right bottom left*/ margin-top: 50px; margin-left: 235px; p { width: 80%; h1 { font-family: Georgia, "Times New Roman", Times, serif; font-size: 18px; color: #000000; li {

list-style-type: none; line-height: 150%; list-style-image: url(../images/arrowsmall.gif); or li { list-style-type: disc; line-height: 150%; --------------------------------------------------------------------------------------------------------------- Grouping Selectors h1,h2,p { color:green; --------------------------------------------------------------------------------------------------------------- Nesting Selectors It is possible to apply a style for a selector within a selector. In the example below, one style is specified for all p elements, one style is specified for all elements with class="marked", and a third style is specified only for p elements within elements with class="marked": p { color:blue; text-align:center;.marked { background-color:red;

.marked p { color:white; --------------------------------------------------------------------------------------------------------------- Images All block-level and inline elements (tags) can have background images inserted into them. Block-level tags are <p> and <div>. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <title>css image placement</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <style type="text/css" media="screen"> #headline1 { background-image: url(images/newsletter_headline1.gif); background-repeat: no-repeat; background-position: left top; padding-top:68px; margin-bottom:50px; #headline2 { background-image: url(images/newsletter_headline2.gif); background-repeat: no-repeat; background-position: left top; padding-top:68px; </style> </head> <body> <div id="headline1">some text </div> <div id="headline2">some more text.. </div> </body> </html>

--------------------------------------------------------------------------------------------------------------- Insert CSS into webpages 1. With an external file that you link to in your web page: <link href="mycssfile.css" rel="stylesheet" type="text/css"> 2. By creating a CSS block in the web page itself; typically inserted at the top of the web page in between the <head> and </head> tags: <head> <style type="text/css"> p { padding-bottom: 12px; </style> </head> 3. By inserting the CSS code right on the tag itself: <p style="padding-bottom:12px;">your Text</p> Generally speaking we can say that all the styles will "cascade" into a new "virtual" style sheet by the following rules, where number four has the highest priority: 1. Browser default 2. External style sheet 3. Internal style sheet (in the head section) 4. Inline style (inside an HTML element) ---------------------------------------------------------------------------------------------------------------