CS 174: Server-Side Web Programming February 7 Class Meeting

Slides:



Advertisements
Similar presentations
LIS901N: Style sheet Thomas Krichel Style sheets Style sheets are the officially sanctioned way to add style to your document We will cover.
Advertisements

Web Engineering 1 Ishaq Khan Shinwari MCS City University Peshawar.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
Very quick intro HTML and CSS. Sample html A Web Title.
Cascading Style Sheets (CSS): Pixel-Level Control with HTML Ease
Cascading Style Sheets Basics. Why use Cascading Style Sheets? Allows you to set up a series of rules for all pages in a site. The series may be changed.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
Part 3 Introduction to CSS. CSS Text Text Styles h1 {color: green} // rgb(0,255,0), #00ff00 h2{letter-spacing: 0.5cm} // 2px h3 {text-align: right} //
Measurement Many CSS properties (values within the declaration) require that you specify a unit of measurement, such as spacing between elements, border.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
+ Text & Font Styles Unit 3 Lesson Different Font Categories Sans Serif – block style fonts Example - Rockwell Easy to read and good to use when.
Chapter 7 Web Typography Principles of Web Design, 4 th Edition.
Chapter 11 & 12 CSS Style Sheets: Intro. Why CSS? Separate presentation from content – more accessible Less work – can change appearance of whole site.
1 CS428 Web Engineering Lecture 07 Font, Text & Background (CSS - II)
Creating Web Documents CSS examples (do more later) Lab/Homework: Read chapters 15 & 16. Work on Project 3, do postings.
WebD Introduction to CSS By Manik Rastogi.
CSS.
Laying out Elements with CSS
Cascading Style Sheets Layout
CMPE 280 Web UI Design and Development September 5 Class Meeting
The Box Model in CSS Web Design – Sec 4-8
Cascading Style Sheets Boxes
CS3220 Web and Internet Programming CSS Basics
The Internet 10/11/11 Fonts and Colors
Cascading Style Sheets™ (CSS)
( Cascading style sheet )
The Box Model in CSS Web Design – Sec 4-8
Creating Your Own Webpage
Introducing :CSS Cascading Style Sheets in 5 Lessons.
Webpage layout using CSS
Creating Page Layouts with CSS
Chapter 6 Cascading Style Sheets™ (CSS)
Cascading Style Sheets
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Cascading Style Sheets (Formatting)
CSS3 Cascading Style Sheet
The Box Model in CSS Web Design – Sec 4-8
CSS Applications to XML 19-Sep-18.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Creating Layouts Using CSS
Cascading Style Sheets
CSS – Properties & Values
The Internet 10/13/11 The Box Model
CSS Borders and Margins.
Second CSS Lecture Applications to XML
Cascading Style Sheets
MORE Cascading Style Sheets (The Positioning Model)
CMPE 280 Web UI Design and Development September 4 Class Meeting
CSS Style Sheets: Intro
Cascading Style Sheets Color and Font Properties
Cascading Style Sheets
Web Development & Design Foundations with H T M L 5
How to use the CSS box model for spacing, borders, and backgrounds
CS3220 Web and Internet Programming CSS Basics
Chapter 7 Web Typography
CMPE 280 Web UI Design and Development February 7 Class Meeting
CS3220 Web and Internet Programming CSS Basics
Cascading Style sheet. What is CSS?  CSS stands for Cascading Style Sheets  Cascading: refers to the procedure that determines which style will apply.
Lesson 5 Topic B – Basic Text & Fonts
Cascading Style Sheets
Stylin’ with CSS.
Cascading Style Sheets
CSS Applications to XML 20-May-19.
Session IV Chapter 15 - How Work with Fonts and Printing
CSS Applications to XML 3-Jul-19.
Cascading Style Sheets
Cascading Style Sheets™ (CSS)
Cascading Style Sheets
CMPE 280 Web UI Design and Development September 5 Class Meeting
Presentation transcript:

CS 174: Server-Side Web Programming February 7 Class Meeting Department of Computer Science San Jose State University Spring 2018 Instructor: Ron Mak (substitute for Fabio Di Troia) www.cs.sjsu.edu/~mak

HTML and CSS HTML Cascading Style Sheet (CSS) content organization semantics Cascading Style Sheet (CSS) layout formatting

Formatting Text Format text by setting font properties: family style weight size line height color spacing and indentation alignment transformations and variants

Font Family Example: Surround multi-word names with quotes. Generic font families: serif sans-serif cursive body { font-family: Geneva; } h1, h2 { font-family: "Gill Sans"; fantasy monospace

Font Family, cont’d Specify alternate font families. In case a browser lacks a font family. Example: Default font families shared by Microsoft Windows and Mac OS X: Arial Comic Sans MS Courier New h1 { font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif; } New Times Roman Verdana

Font Style Font styles are normal, italic, or oblique (faux italic). Not all font families have true italic. Example: h1: { font-style: oblique; } p: { font-style: italic;

Font Weight Font weights are normal, bold, bolder, or lighter. Example: Also: 100, 200, 300, 400, 500, 600, 700, 800, or 900 .special { font-weight: bold; }

Font Size Default sizes: xx-small x-small small Specify font size with absolute or relative units. Absolute units in pixels (px) or points (pt) Example: There is no space between the number and px or pt. medium large x-large xx-large smaller larger h1 { font-size: 35px; } Use points for printing.

Font Size, cont’d Relative units By percentage of the default size (usually 16px). By ratio of the parent element’s font size (em units). Examples: body { font-size: 100%; /* 16px */ } h1 { font-size: 2.1875em; /* 35px/16px */ h2 { font-size: 1.75em; /* 28px/16px */ Establish the baseline size. In traditional typesetting, an em unit is the width of the letter m.

Line Height Specify line height: as a multiple of the font size as a percentage of the font size in em, px, or pt units Example: p { line-height: 1.65; /* 15px x 1.65 = 24.75px */ }

Points, Pixels, and Em Conversion chart for points, pixels, and em: https://websemantics.uk/articles/font-size-conversion/

Font Variants Font variants are normal or small-caps. Example: h2 { font-variant: small-caps; }

Combining Font Values Use the font property to combine font values. Size, families, weight, variant, line height List the values in any order, separated by blanks. You must specify the font size and font families. Size before families, only a blank after the size. Specify line height immediately after the font size, separated by a slash. Followed by a blank and the font families. Example: p { font: italic small-caps bold .85em/1.2 Palatino, serif; }

Line and Letter Spacing Specify line spacing and letter spacing with absolute px units or relative em units. Example: h2 { font-family: "Gill Sans", "Gill Sans MT", Calibri, sans-serif; font-weight: normal; letter-spacing: 7px }

Text Alignment Text alignments are left, right, center, or justify. Example: h1 { text-align: center; } p { text-align: justify; .intro .subhead {

Text Indentation Specify paragraph indentation with absolute px units or relative em units. Example: p { text-indent: 2em; }

Text Transformation Text transformations are none, capitalize, uppercase, or lowercase. Example: h1 { text-transform: uppercase; }

Controlling the Display of Elements Each HTML element has a default display property setting. Example: Paragraphs are display: block and emphasized text are display: inline CSS rules can override the default display. Example: em { display: block; } The following is some emphasized text that displays as a block.

The Box Model CSS treats every HTML element as if it were enclosed in an invisible box: width height padding borders margins Use absolute or relative units, or auto.

Borders Set the values of each border: Also: border-top, border-bottom border-left, border-right Or just border to set the values of all four borders Also: border-color border-width border-style none, dotted, dashed, solid, double, groove, ridge, inset, outset .about img { border: 5px solid gray; } .nav-main { border-top: 5px solid red; border-bottom: 1px solid red;

Padding Set the size of the padding on each side: padding-top, padding-bottom padding-left, padding-right Padding color is the background-color.

Padding, cont’d Also: padding: size Applies to all sides padding: sizetb, sizerl sizetb applies to the top and bottom and sizerl applies to the right and left padding: sizet, sizerl, sizeb sizet applies to the top, sizeb applies to the bottom, and sizerl applies to the right and left padding: sizet, sizer, sizeb, sizel in clockwise order .about { background-color: white; padding: .3em .6em .3em; }

Margins Set margin sizes (similar to padding sizes): Also: margin-top, margin-bottom margin-left, margin-right Also: margin: size margin: sizetb, sizerl margin: sizet, sizerl, sizeb margin: sizet, sizer, sizeb, sizel h1: { margin-bottom: .4em; }

Floating Elements An element can float among text or other elements by making that other content flow around it. float: left Put the element to the left of the other content. float: right float: none .post-photo { float: left; margin-bottom: 2px; margin-right: 22px; }

Relative Positioning Position an element relative to its natural location. position: relative; Add any top, right, bottom, or left offsets. Relative positioning does not affect any surrounding elements.

Relative Positioning, cont’d Example: <h1>Relative Positioning</h1> <p>When you position an element relatively, you <span class="example">position it</span> relative to its normal location.</p> .example { position: relative; top: 35px; left: 100px; }

Absolute Positioning Position an element absolutely by specifying its position with respect to the page body or to its nearest positioned ancestor element. position: absolute Add any top, right, bottom, or left positions in px, em, or percentage of the ancestor. If elements overlap, specify a z-index value. Elements with higher z-index values overlap elements with lower values. Compare the z-index values only for elements in the same container.

Vertical Alignment Use vertical-align to align an element: baseline Align the element’s baseline with its parent’s baseline. middle Align the middle of the element slightly above the parent’s baseline. sub Position the element as a subscript of the parent’s baseline. super Position the element as a superscript of the parent’s baseline.

HTML Container Elements Semantic containers <header> … </header> <footer> … </footer> <main> … </main> <aside> … </aside> <nav> … </nav> <article> … </article> <section> … </section> Generic containers <div> … </div> <span> … </span> Have meaning relative to organization. No inherent meaning. Used to apply styling. Contain a block of content. Contain a word or phrase.

ARIA Landmark Roles WAI-ARIA Web Accessibility Initiative Accessible Rich Internet Application Add ARIA roles to HTML elements to guide HTML screen readers for the visually impaired. Example: Encloses a major block of navigation links. Tip to screen readers. <nav role="navigation"> … </nav>

Page with No Styles http://www.htmlcssvqs.com/8ed/examples/chapter-11/no-styles.html

Styled Page Header http://www.htmlcssvqs.com/8ed/examples/chapter-11/finished-page.html Main Sidebar Footer