CSS Cascading Style Sheets Jim Eng

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

Cascading Style Sheets
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.
Very quick intro HTML and CSS. Sample html A Web Title.
CSS Cascading Style Sheets Charles Severance
กระบวนวิชา 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.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
1 CSS Styling with Fonts and Colors. 2 CSS Cascading Style Sheets and fonts CSS provides Style or Presentation options for our html pages CSS properties.
SM5312 week 6: basic CSS syntax1 An Introduction to Cascading Style Sheets Basic CSS Syntax Nick Foxall.
Workshop: CSS-Part I Cascading Style Sheets add style to your HTML web pages.
First CSS Lecture Applications to HTML
Cascading Style Sheet (CSS) Instructor: Dr. Fang (Daisy) Tang
More HTML Chapter 4. 2 Nesting Tags How do you write the following in HTML? The wrong way: This is really, REALLY fun ! Tags must be correctly nested.
WEB PAGES: CREATING AND MAINTAINING ** Tom Keane & Mayis SeapanInstructors: HTML Tags to format your text.
Lecture CSS: Cascading Style Sheets. What are Styles? Cascading Style Sheets (CSS) is a style sheet language used to describe the presentation semantics.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
© 2007 D. J. Foreman CSS-1 Cascading Style Sheets Styles.
3.1 Cascading Style Sheets. Motto Fashions fade, style is eternal. —Yves Saint Laurent.
Stylin’ with CSS. 2 Topics What is CSS? Why CSS? CSS Examples.
Selectors thru Borders. CSS – Cascading Style Sheets – is a way to style HTML HTML is the content base of a web page CSS provides the presentation qualities.
HIGHER COMPUTING CSS. WHAT IS CSS? CSS: Cascaded Style Sheets used to separate a web site’s content(information) from its style(how it looks).
Cascading Style Sheets (CSS) IT210: Web-based IT.
Review: Three parts to a webpage: - Content - Structure  XHTML - Presentation  CSS In this chapter we will focus on introducing and examining the mechanics.
Cascading style sheets (CSS)
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 3 Key Concepts 1 Copyright © Terry Felke-Morris.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Tutorial #3 Cascading Style Sheets. Review: Last Class Image sizing Pathnames Project Default Path Relative Path Absolute Path Blackboard Homework Submission.
Cascading Style Sheets CSS. CSS - Structure Declaration block Property: identifies what to change Value: how to change it Selector – example h1{ font-size:
Today’s objectives  Complete web page  Using xhtml & CSS  Adding CSS to documents Embed url(File);  CSS.
 HTML stands for Hyper Text Mark-up Language. The coding language used to create documents for the World Wide Web  HTML is composed of tags. HTML tags.
Cascading Style Sheets by Pavlovic Nenad by. Presentation Contents  What is CSS?  Why CSS?  Types of Style Sheets  Style Sheets Syntax  Box Formatting.
 A style sheet is a single page of formatting instructions that can control the appearance of many HTML pages at once.  If style sheets accomplished.
CSS My favourite ICT lesson By Federico Boschi Cascading Style Sheets.
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.
Tutorial #3 Cascading Style Sheets. Tutorial #2 Review - Anchors Links to Site DMACC Internal Links Go to Top Mail To me Local.
CSS. HTML: Looking Back HTML dictates order, structure, and function Does very little to specify layout or visual rendering.
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.
Stylin’ with CSS Monday October 8 th and Tuesday October 9 th.
CSS Cascading Style Sheets. CSS Advantages Greater typography and page layout control Style is separate from structure Styles can be stored in a separate.
HTML - Quiz #2 Attendance CODE:
Files you will need ... Black Goose Bistro Summer Menu
Lesson 03 // Cascading Style Sheets. CSS Stands for Cascading Style Sheets. We’ll be using a combination of Html and CSS to create websites. CSS is a.
More CSS.
Cascading Style Sheets Robin Burke ECT 270. Outline Midterm The Layout Debate CSS properties Fonts Alignment Color CSS selection selectors pseudo-classes.
Creating Your Own Webpage COSC Cascading Stylesheets Think of: HTML: content of your webpage HTML has tags CSS: presentation and appearance of your.
CSS - Part 2 Cascading Style Sheets Jim Eng Thanks to Gonzalo Silverio for some slides
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Cascading Style Sheets (CSS). A style sheet is a document which describes the presentation semantics of a document written in a mark-up language such.
Cascading Style Sheets Eugenia Fernandez IUPUI. CSS Purpose CSS allow you to specify the style in which your XML elements are displayed. CSS were originally.
1 Web Development CSS (Cascading Style Sheet). 2 1.Setting rules for multiple elements To decrease the amount of typing for setting rules for multiple.
5 th ed: Chapter 4 4 th ed: Chapter 5 SY306 Web and Databases for Cyber Operations Slide Set #4: CSS.
CSS for Styling CS The good, the bad and the… ugly!  Tags such as b, i, u, and font are discouraged in strict XHTML  Why is this bad? CS380 2.
Cascading Style Sheets Primary readings Presentations Explain & review projects with class mates.
Developing Web Applications with HTML and CSS “Selectors and Properties”
Web Design (14) CSS Formatting Text. Formatting Text In Brackets, go to your ‘externalcss’ website and find the ‘formattingtext’ page. Use the ‘main’
CSS: Cascading Style Sheets Part II. Style Syntax.
CSS Cascading Style Sheets *referenced from
Chapter 11 & 12 CSS Style Sheets: Intro. Why CSS? Separate presentation from content – more accessible Less work – can change appearance of whole site.
CSS Introductions. Objectives To take control of the appearance of a Web site by creating style sheets. To use a style sheet to give all the pages of.
Cascading Style Sheets Robin Burke ECT 270. Outline CSS properties Fonts Alignment Color CSS selection selectors.
CSS Cascading Style Sheets Charles Severance
Applying Basic Styles. The Browser has “default styling” for all tags. AppEngineLearn Sites Topics Google App Engine: About Welcome to the site dedicated.
CONFIGURING COLOR AND TEXT WITH CSS Chapter 3. Cascading Style Sheets (CSS) Used to configure text, color, and page layout. Launched in 1996 Developed.
Creating Your Own Webpage
Cascading Style Sheets
Cascading Style Sheets
Stylin’ with CSS.
Stylin’ with CSS.
Presentation transcript:

CSS Cascading Style Sheets Jim Eng

Zen Garden A social site where CSS designers show their “stuff” The HTML never changes - only the CSS Inspiration for designers

The big picture... strict.dtd d> University of Mich University of "/CSS/graphical.css"/**/; p.text strong,.verbose,.verbose p,.verbose h2{text-indent:- 876em;position:absolute} p.text strong a{text-decoration:none} p.text em{font-weight:bold;font-style:normal} div.alert{background:#eee;border:1px solid red;padding:.5em;margin:0 25%} a img{border:none}.hot br,.quick br, dl.feature2 img{display:none} div#main label, legend{font-weight:bold} In the modern era of web design we represent content and meaning in HTML and formatting and layout in CSS.

Separation of concerns / specialization strict.dtd d> University of Mich University of "/CSS/graphical.css"/**/; p.text strong,.verbose,.verbose p,.verbose h2{text- indent:-876em;position:absolute} p.text strong a{text-decoration:none} p.text em{font-weight:bold;font-style:normal} div.alert{background:#eee;border:1px solid... DeveloperDesigner Everyone needs to know some HTML and some CSS and some programming - but to be truly skilled at a professional level requires deep understanding and specialization.

SI502 Books Topics Networked Computing: About This course is a survey course covering a broad range of technology topics at a high level. The course is aimed at students with no prior technical skills other than the general use of a computer. Really! When building HTML, we add little “handles” in the HTML to make it so we can “style” areas of the document.

body { font-family: arial, san-serif; } a, a:link { color: #0000cc; } + CSS (Cascading Style Sheet)

HTML has evolved a *lot* over the years - as computers and networks have gotten faster.

Three ways to add style Inline Style - Add style information to a tag Embedded Style - Add style information to the document at the beginning External Style Sheet - Put all of your style in an external file - preferred because two people can work independently

Inline Styles A sentance. The quick brown fox jumps over the lazy dog. Another sentance.

Span when there is no block Bubble Under is a group of diving enthusiasts based in the south-west UK who meet up for diving trips in the summer months when the weather is good and the bacon rolls are flowing. We arrange weekends away as small groups to cut the costs of accommodation and travel and to ensure that everyone gets a trustworthy dive buddy.

Embedded Style

Anatomy of a CSS Rule

External Style Sheets ext.htm ext.css

We have styled the site *after* the HTML was prodced.

Now we are stylin’ body { font-family: Verdana, Helvetica, Arial, sans-serif; background-color: #e2edff; line-height: 125%; padding: 15px; } h1 { font-family: "Trebuchet MS", Helvetica, Arial, sans-serif; font-size: x-large; } li { font-size: small; } h2 { color: blue; font-size: medium; font-weight: normal; } p { font-size: small; color: navy; }

Body Styling body { font-family: Verdana, Helvetica, Arial, sans-serif; background-color: #e2edff; line-height: 125%; padding: 15px; } This applies to everything in the document between and - it is inherited by paragraphs within body

Color Names W3C has listed 16 color names that will validate with an HTML validator. The color names are: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow.

Colors by the number... #e2edff Three Numbers, Red, Green, and Blue - each from 00 - FF (Hexidecimal) #ffffff = white # = black #ff0000 = red #00ff00 = green #0000ff = blue Web-safe colors

Fonts Default fonts are ugly and they have Serifs - which make them harder to read on a screen So the first thing I usually want to do is override the font in my document And I want to do this everywhere.

Fonts body { font-family: "Trebuchet MS", Helvetica, Arial, sans-serif; font-size: x-large; } Most FavoriteLeast Favorite Fallback fonts: serif, sans-serif, monospace, cursive and fantasy.

Font Factors font-size: xx-small x-small small medium large x-large xx-large font-weight: bold or normal font-style: normal or italic text-decoration: none, underline, overline, or line-through

Default Styling for Links Downright Ugly!

Styling Links a { font-weight: bold; } a:link { color: black; } a:visited { color: gray; } a:hover { text-decoration: none; color: white; background-color: navy; } a:active { color: aqua; background-color: navy; } link - before a visit visited - after it has been visited hover - when your mouse is over it but you have not clicked active - you have clicked it and you have not yet see the new page Browser default styling for links is downright ugly!

Styling a block with “id” #tagline { font-style: italic; font-family: Times, serif; } Diving club for the south-west UK - let's make a splash! #tagline p { font-style: italic; font-family: Times, serif; } or Everything within blockParagraphs within block id= identifies a *particular* block - only one in a document

Multiple tags with same styling h1, h2, h3 { color: yellow; background-color: black; } Making a noticeable background color is a fun way to debug / identify blocks.

Styling with class=.fun { color: #339999; font-family: Georgia, Times, serif; letter-spacing: 0.05em; } A man walks into a bar; you would've thought he'd see it coming! Have a nice day. More fun stuff Class can be used many times in a document.

Span (Invisible tag) Bubble Under is a group of diving enthusiasts based in the south-west UK who meet up for diving trips in the summer months when the weather is good and the bacon rolls are flowing. We arrange weekends away as small groups to cut the costs of accommodation and travel and to ensure that everyone gets a trustworthy dive buddy. Something you want to style something smaller than a whole block - then use span. Do not use span if you are applying something to a whole block - just put your styling on the enclosing block tag.

An Example Step 1

SI502 Books Topics Networked Computing: About This course is a survey course covering a broad range of technology topics at a high level. The course is aimed at students with no prior technical skills other than the general use of a computer. Really!

body { font-family: arial, san-serif;}a, a:link { color: #0000cc;}a.selected { color: black; text-decoration: none;}#header { font-size: 120%;}.toolbar li { font-size: 14px;}

Summary Thankfully we can assume that browsers in the marketplace have decent support for CSS So we can switch to the best practice HTML contains content and semantic markup CSS styles the tags and semantics

Block Layout

Quick Advertisement - Firefox You pretty much need to use Firefox for serious website development Important plugins: - Web Developer - Chris Pedrick - FireBug - Joe Hewitt

Two kinds of elements Inline - affects how text looks strong, span Block - Containers that can be laid out Paragraphs, etc CSS can change a tag from inline to block #navigation li { display: inline;}

Inline Elements Flowed with other text span, em, strong, cite, a Inline tags can be nested as long as they match Stuff Block can contain inline - but inline cannot contain block

Block Level Elements Starts on its own line - ends justification and starts a new block Can be a container for other elements h1 - h6, p, div, blockquote, ul, ol, form Blocks can contain other blocks One Two

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

The Box Model.trapped { height: 100px; width: 200px; margin: 20px; border: 5px solid yellow; background:red; padding: 20px; font-family:Arial; color:orange; font-size:20px;} I am trapped in a glass case of emotion which is 100px high and 200px wide

Border, padding, and margin are additive..trapped { height: 50px; width: 50px;}.trapped2 { height: 50px; width: 50px; border: 5px solid yellow; padding: 10px;} One Two

An Example

SI502 Books Topics Networked Computing: About This course is a survey course covering a broad range of technology topics at a high level. The course is aimed at students with no prior technical skills other than the general use of a computer. Really!

.toolbar li { display:inline; text-align:right;}#header ul { line-height: 1em; text-align: right;} #header h1 { font-size: 20px; font-weight: bold; float: left;}

Inspiration

Summary CSS Layout is its own art and science CSS Basics are well established and well supported in all modern browsers The box model is pretty straightforward - and allows nice design within the standards with reasonable effort levels. Site layout and markup is further evolving - mostly to make it increasingly possible to support desktop like experiences on the web. These innovations will naturally cause incompatibilities - which make things interesting and frustrating at times.