Web Foundations WEDNESDAY, OCTOBER 2, 2013 LECTURE 5: INTRODUCTION TO CSS CONTINUED.

Slides:



Advertisements
Similar presentations
CSS Cascading Style Sheets. Objectives Using Inline Styles Working with Selectors Using Embedded Styles Using an External Style Sheet Applying a Style.
Advertisements

Computer Applications II.  A Style Sheet is a web page development tool that allows the developer to make global changes to a web page (or web site)
Cascading Style Sheets
Cascading Style Sheets
Today CSS HTML A project.
CSS CSS Precise Aesthetic Control. Cascading Style Sheets Though they can be put in HTML header, usually a separate page that the HTML links to Contains.
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.
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.
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
CS4370/6370 Web Development Cascading Style Sheets (CSS)
4.01 Cascading Style Sheets
Instructor: Mike Panitz Crash Course in CSS.
W EB S ITE L ECTURE C ASCADING S TYLE S HEETS. Cascading Style Sheets (CSS) Introduction CSS Objectives – Provide more control over web site content presentation.
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.
Chapter 8 Cascading Style Sheets (CSS). Agenda Definition of a CSS style Types of CSS Styles CSS Backgrounds CSS Text CSS Fonts CSS Links CSS Lists CSS.
Slide 1 of 83 Table Borders To specify table borders in CSS, use the border property. The example below specifies a black border for table, th, and td.
CSS Style Rules Guang Tong, Zhan L;lo’p[ Css Style Rule Guang Tong Zhan Three ways to insert CSS 1 External style sheet 2 Internal style sheet 3 Inline.
Cascading style sheets (CSS)
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Week 4.  Three ways to apply CSS: Inline CSS Internal style sheets ( header style information) External style sheets.
ITP 104.  While you can do things like this:  Better to use styles instead:
The Characteristics of CSS
New Perspectives on XML, 2nd Edition Tutorial 5 1 TUTORIAL 5 WORKING WITH CASCADING STYLE SHEETS.
CSS The Definitive Guide Chapter 8.  Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more.
Web Foundations MONDAY, SEPTEMBER 30, 2013 LECTURE 3: COMMON HTML TAGS, NEW HTML5 SECTIONS, USING FTP.
1 What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles are normally stored in Style Sheets  Styles.
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.
ITCS373: Internet Technology Week 3: Introduction to CSS Dr. Faisal Al-Qaed.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
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.
CIS67 Foundations for Creating Web Pages Professor Al Fichera Rev. September 14, 2010—All HTML code brought to XHTML standards. Reference for CIS127 and.
Cascading Style Sheets (CSS)
Cascading Style Sheets Chapter Four. What are they? A set of style rules that tell the web browser how to present a web page or document. Cascading Style.
آموزش طراحی وب سایت جلسه چهارم– سی اس اس 1 تدریس طراحی وب برای اطلاعات بیشتر تماس بگیرید تاو شماره تماس: پست الکترونیک :
INTRODUCTION TO CSS. OBJECTIVES: D EFINE WHAT CSS IS. K NOW THE HISTORY OF CSS. K NOW THE REASON WHY CSS IS USED. CSS SYNTAX. CSS ID AND CLASS.
Class three: CSS review, backgrounds, font formatting, the box model.
CSS Basic (cascading style sheets)
Cascading Style Sheet Bayu Priyambadha, S.Kom. Definition Cascading Style Sheets (CSS) form the presentation layer of the user interface. –Structure (HTML)
CSS. HTML: Looking Back HTML dictates order, structure, and function Does very little to specify layout or visual rendering.
CSS -- TEXT.  Text Color  The color property is used to set the color of the text.  With CSS, a color is most often specified by:  a HEX value - like.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
MySQL and PHP Review CSS. Cascading Style Sheet (CSS) Style sheets are files or forms that describe the layout and appearance of a document. Cascading.
Cascade Style Sheet Introduction. What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements  Styles were added.
Basics of Web Design Chapter 6 More CSS Basics Key Concepts.
Web Foundations THURSDAY, OCTOBER 3, 2013 LECTURE 6: CSS CONTINUED.
DIV, Span, CSS.
3. Cascading Style Sheets (CSS) M. Udin Harun Al Rasyid, S.Kom, Ph.D Lab Jaringan Komputer.
CSS Fun damentals The Document Hierarchy Element Relationships The Box Model.
REEM ALMOTIRI Information Technology Department Majmaah University.
CIS234A Lecture 5 Instructor Greg D’Andrea. Font Styles Review Font-Family: generic family, font family Font-Size: em, pt, px, %, mm, cm, in Font-Style:
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
آموزش طراحی وب سایت جلسه پنجم– سی اس اس 2 تدریس طراحی وب برای اطلاعات بیشتر تماس بگیرید تاو شماره تماس: پست الکترونیک :
Today’s objectives Layouts | floats Measurement units Type properties
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring
CSS Syntax. Syntax The CSS syntax is made up of three parts: a selector, a property and a value: selector {property: value}
1 CSS محمد احمدی نیا 2 Of 21 What is CSS?  CSS stands for Cascading Style Sheets  Styles define how to display HTML elements 
NASRULLAHIBA.  It is time to take your web designing skills to the next level with Cascading Style Sheets (CSS). They are a way to control the look and.
Creating Layouts with CSS. Span tag Here is some underlined text. Here is some blinking text. Here's some bold text.
Basic Webpage Design Cascading Style Sheet (CSS).
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
1 CS428 Web Engineering Lecture 07 Font, Text & Background (CSS - II)
HTML & CSS Contents: the different ways we can use to apply CSS to The HTML documents CSS Colors and Background CSS Fonts CSS Text CSS box model: padding,
CSS DHS Web Design. Location Between the & Start with – End with –
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 solve a problem External.
CONFIGURING COLOR AND TEXT WITH CSS Chapter 3. Cascading Style Sheets (CSS) Used to configure text, color, and page layout. Launched in 1996 Developed.
CSS.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Web Programming and Design
Presentation transcript:

Web Foundations WEDNESDAY, OCTOBER 2, 2013 LECTURE 5: INTRODUCTION TO CSS CONTINUED

HTML & CSS for Page Layout As we saw in a previous lecture, the semantic markup introduced in HTML5 allows to construct page layouts differently. Although we still can use tags for creating layouts, many of the standard page elements such as header, navigation, footer have now their own tags. This does not change the way CSS and HTML work together but it makes our code more meaningful and saves us from typing some 's (we can still use divs to create "wrappers" to center sections, produce "responsive" pages, etc). NOTE: We will discuss "id" and "class" a bit later in today's lecture

HTML & CSS for Page Layout A basic layout uses a header, a main content area and a footer. On the HTML side there is nothing new except that we use might a div wrapper layer for centering the content in the browser. This is the header Here would come the main content Last but not least, the footer NOTE: We will discuss "id" and "class" a bit later in today's lecture Without the CSS, the web page looks pretty basic, even though all the HTML tags are in place. We'll use the CSS to jazz things up a bit.

CSS Syntax (Review) A CSS declaration always ends with a semicolon, and declaration groups are surrounded by curly brackets or "squiggles": p {color:red; text-align:center;}

HTML & CSS for Page Layout Now looking at the CSS, first we reset the margin and padding of all elements to zero and tell the browser to render all HTML5 section tags as block. * { margin:0px; padding:0px;} header, footer, section, aside, article, nav { display: block;} NOTE: We will discuss "id" and "class" a bit later in today's lecture

HTML & CSS for Page Layout The wrapper centers the rest of the content div#wrapper { width:90%; margin:0px auto;} NOTE: We will discuss "id" and "class" a bit later in today's lecture

HTML & CSS for Page Layout While we simply add some color to distinguish the three sections of the document: header, the main section and the footer. header { background-color:#CCA; height:50px;} section { background-color:#F3C200; height:100px;} footer { background-color:#CC6; height:20px;} NOTE: We will discuss "id" and "class" a bit later in today's lecture

HTML & CSS for Page Layout Putting it all together and the CSS render content of the now page looks like this: NOTE: We will discuss "id" and "class" a bit later in today's lecture Demo code: test001.html test001.html

Commenting Some notes about these CSS properties, attributes, and values: First, commenting inside HTML and CSS HTML Comment CSS Comment /* Comment Goes Here */ Demo: HTML Comment in CCS Internal Style

The id Selector: # Standards specify that any given id name can only be referenced once within a page or document. From my experience, ids are most commonly used correctly in CSS layouts. This makes sense because there are usually only one 'wrapper' per page, or only one menu, one banner, usually only one content pane, etc. What this means is, two selectors cannot us the same id. If you want to do that, then you would create and use a class (which we'll talk about a bit later). NOTE: Do NOT start an id name with a number! It will not work in Firefox. In the CSS div#wrapper { width:70%;  sets width of div in relation to the browser margin:0px auto;} In the HTML... Demo: ID in CCS

The margin Property The margin clears an area around an element (outside the border). The margin does not have a background color, and is completely transparent. The top, right, bottom, and left margin can be changed independently using separate properties. A shorthand margin property can also be used, to change all margins at once. W3Schools: marginmargin The margin property can have from one to four values: margin:25px 50px 75px 100px; top margin is 25px right margin is 50px bottom margin is 75px left margin is 100px margin:25px 50px 75px; top - right/left - bottom top margin is 25px right and left margins are 50px bottom margin is 75px margin:25px 50px; top/bottom - right/left top and bottom margins are 25px right and left margins are 50px margin:25px; all four margins are 25px margin-top:100px; margin-bottom:100px; margin-right:50px; margin-left:50px;

The height Property The height property sets the height of an element, whether in by auto (default), length (px, cm, pt, etc). height:50px; W3Schools: heightheight

The background-color Property The background-color property sets the background color of an element. background-color:#CCA;  or #CCCCAA W3Schools: background-colorbackground-color

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 is defined with a period or "dot":. NOTE: You can name a class anything you want, although it is recommended you give it a name according to its function. In the example below, all HTML elements with class="center" will be center-aligned: In the CSS.center {text-align:center;} In the HTML Rex Winkus's Portfolio Week 01 W3Schools: Class vs IDClass vs ID

The class Selector, specified by a HTML Element You can also specify that only predetermined HTML elements should be affected by a class. In other words, even if other elements call a class by name, only the type of element uniquely specified will be affected by the call. In the CSS p.center{text-align:center; } In the HTML This heading will not be affected This paragraph will be center-aligned. W3Schools: Class vs IDClass vs IDhttp://

Some Other Basic CSS Properties: font-family In the CSS [remember, that these class names can be anything you want] p.serif{font-family:"Times New Roman",Times,serif;} p.sansserif{font-family:Arial,Helvetica,sans-serif;} In the HTML This is heading 1  This isn't affected This is heading 2  This isn't affected This is a paragraph. This is a paragraph. W3Schools: font-familyfont-family

Some Other Basic CSS Properties: font-size In the CSS h1 {font-size:250%;} h2 {font-size:200%;}.ften {font-size:10pt;}.f875em {font-size:0.875em;} In the HTML This is heading 1 This is heading 2 This is a paragraph. This is a paragraph. This is a paragraph. W3Schools: font-sizefont-size An "em" is a relative property based on the default font-size of the browsers, which is typically 16px. For example, this means that: 1em = (16 x 1) = 16px = 100% 1.25em (16 x 1.25) = 20px = 125% 0.75em (16 x 0.75) = 12px = 75% 2em (16 x 2) = 32px = 200%

Some Other Basic CSS Properties: font-style In the CSS [remember, that these class names can be anything you want].normal {font-style:normal;} p.italic {font-style:italic;}.oblique {font-style:oblique;} In the HTML This is a paragraph, normal. This is a paragraph, italic. This is a paragraph, oblique. This is a heading1, oblique. W3Schools: font-stylefont-style

Some Other Basic CSS Properties: font-variant In the CSS [remember, that these class names can be anything you want].normal {font-variant:normal;}.small {font-variant:small-caps;} In the HTML Rex Winkus's Portfolio My name is Rex Winkus. W3Schools: font-variantfont-variant

Some Other Basic CSS Properties: font-weight In the CSS [remember, that these class names can be anything you want] p.normal {font-weight:normal;} p.light {font-weight:lighter;} p.thick {font-weight:bold;} p.thicker {font-weight:900;} In the HTML This is a paragraph. W3Schools: font-weightfont-weight ValueDescription normalDefault. Defines normal characters boldDefines thick characters bolderDefines thicker characters lighterDefines lighter characters Defines from thin to thick characters. 400 is the same as normal, and 700 is the same as bold

Some Other Basic CSS Properties: font (shorthand property) The font shorthand property sets all the font properties in one declaration. The properties that can be set, are (in order): "font-style font-variant font-weight font-size/line-height font-family". The font-size and font-family values are required. If one of the other values are missing, the default values will be inserted, if any. In the CSS [remember, that these class names can be anything you want].ex1{font:15px arial,sans-serif;} p.ex2{font:italic bold 12px/30px Georgia,serif;} In the HTML Rex Winkus's Portfolio My name is Rex Winkus. My name is Rex Winkus.  This is not altered W3Schools: font (shorthand)font (shorthand)

Some Other Basic CSS Properties: line-height The line-height property specifies the line height. In the CSS [remember, that these class names can be anything you want] p.normal{line-height:100%}  100% of normal, or 16px p.small {line-height:90%}  90% of normal, or 14.4px p.big {line-height:2}  twice normal line height, or 32px p.reallybig {line-height:48px}  three times normal line height, or 3 In the HTML Rex Winkus's Portfolio My name is Rex Winkus. My name is Rex Winkus.  This is not altered W3Schools: line-heightline-height

Some Other Basic CSS Properties: text-decoration The text-decoration property specifies the decoration added to text. In the CSS [remember, that the class names can be anything you want] h1 {text-decoration:overline;} h2 {text-decoration:line-through;} h3 {text-decoration:underline;}.none {text-decoration:none;} In the HTML This is heading 1 This is heading 2 This is heading 3 Google W3Schools: text-decorationtext-decoration

Some Other Basic CSS Properties: text-align The text-align property specifies the horizontal alignment of text in an element. In the CSS h1 {text-align:center} h2 {text-align:left} h3 {text-align:right} In the HTML This is heading 1 This is heading 2 This is heading 3 W3Schools: text-aligntext-align ValueDescription leftAligns to the left rightAligns to the right centerCenters the text justifystretches the lines so each line has equal width

Some Other Basic CSS Properties: text-transform The text-transform property controls the capitalization of text. In the CSS h1 {text-transform:uppercase;} h2 {text-transform:capitalize;} p {text-transform:lowercase;} In the HTML This is some text. W3Schools: text-transformtext-transform ValueDescription noneNo capitalization. The text renders as it is (this is the default) capitalizeTransforms the first character of each word to uppercase uppercaseTransforms all characters to uppercase lowercaseTransforms all characters to lowercase

Some Other Basic CSS Properties: color The color property specifies the color of text. In the CSS body {color:red;} h1 {color:#00ff00;} p.ex {color:rgb(0,0,255);} In the HTML This is heading 1 This is an ordinary paragraph. Notice that this text is red. The default text-color for a page is defined in the body selector. This is a paragraph with class="ex". This text is blue. W3Schools: colorcolor ValueDescription colorSpecifies the text color. Look at CSS Color Values for a complete list of possible color values. CSS Color Values inheritSpecifies that the color should be inherited from the parent element