Cascading Style Sheets (CSS) Part II IT210: Web-based IT.

Slides:



Advertisements
Similar presentations
Copenhagen, 6 December 2004 Modern CSS Principles Miruna Bădescu Finsiel Romania.
Advertisements

1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
CSS Internet Engineering Spring 2014 Bahador Bakhshi CE & IT Department, Amirkabir University of Technology.
CSS Layout Crash Course An Advance CSS Tutorial. Inline vs. Block Many HTML elements have a default display setting of Block. Block elements take up the.
Part 5 Introduction to CSS. CSS Display - Block and Inline Elements A block element is an element that takes up the full width available, and has a line.
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
CSS provides a way to stray away from the traditional methods of using tables to lay out pages. Success with this technique depends on understanding of.
Tutorial 5 Working with the Box Model. XP Objectives Understand the box model Create padding, margins, and borders Wrap text around an image Float a block-level.
Using CSS for Page Layout. Types of HTML Elements Block-Level Element –Creates blocks of content e.g. div, h1..h6, p, ul, ol, li, table, form –They start.
CSS, cont. October 12, Unit 4. Creating a Sidebar We know how to create a sidebar –Use the float property div#sidebar{ float: left; } Item1 Item2 Item3.
XHTML and CSS Overview. Hypertext Markup Language A set of markup tags and associated syntax rules Unlike a programming language, you cannot describe.
An Introduction to Cascading Style Sheets CSS Layout, and the CSS Box Model Nick Foxall SM5312 week 9: CSS Layout.
XHTML and CSS Overview. Hypertext Markup Language A set of markup tags and associated syntax rules Unlike a programming language, you cannot describe.
MORE Cascading Style Sheets (The Positioning Model)
4.01 Cascading Style Sheets
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.
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
ITP 104.  While you can do things like this:  Better to use styles instead:
Cascading Style Sheets CSS. CSS Positioning Normal Flow Top -> bottom | left -> right Arranged in the order they appear in the code make room for one.
Cascading Style Sheets CSS. div … Used like a container to group content Gives context to the elements in the grouping Give it a descriptive name with.
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
Doman’s Sections Information in this presentation includes text and images from
MCS 270 Cascading Style Sheets (CSS) Gustavus Adolphus College.
CSS: Cascading Style Sheets. 2 What are Style Sheets A style sheet is a mechanism that allows to specify how HTML (/XHTML/XML) pages should look The style.
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.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Neal Stublen Course Road Map  Create web page layouts using CSS  Manage CSS  Test website validity  Create navigation menus using.
CSS = Cascading Style Sheet CSS consists of rules to display, style and decorate HTML elements Why CSS ? – Separate decoration from HTML markup (Ex :,,…)
Lecture 2 - HTML and CSS Review SFDV3011 – Advanced Web Development 1.
Web Programming Language CSS – Part 2 Dr. Ken Cosh (CSS II)
Week 8 – Part 2 Page Layout Basics Key Concepts 1.
Web Foundations MONDAY, OCTOBER 7, 2013 LECTURE 7: CSS LINK COLORS, INTERMEDIATE CSS.
Web Development & Design Foundations with XHTML Chapter 6 Key Concepts.
CONTROLLING Page layout
Tutorial 4 Creating Page Layouts with CSS
CSS: Cascading Style Sheets Part II. Style Syntax.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring 2016 CSS Positioning 1.
CIS67 Foundations for Creating Web Pages Professor Al Fichera Rev. September 22, 2010—All HTML code brought to XHTML standards. Reference for CIS127 and.
- WE’LL LOOK AT THE POSITION PROPERTY AND HOW CSS RESOLVES CONFLICTS BETWEEN STYLING INSTRUCTIONS The position property; CSS specificity hierarchy.
CIS234A Lecture 6 Instructor Greg D’Andrea. Span and Div The span and div elements are a generic means by which we can add structure to documents. The.
HTML 5 AND CSS Dr Mohd Soperi Mohd Zahid Semester /16.
Chapter 4 and 5. Objectives Introduce markup: elements and attributes How browsers interpret HTML documents Basic structure of HTML document What do style.
Cascading Styles Sheets Positioning HTML elements.
CHAPTER 15 Floating and Positioning. FLOAT VS. POSITION  Floating an element moves it to the left or right, allowing the following text to wrap around.
Laying out Elements with CSS
Cascading Style Sheets Layout
Web Development & Design Foundations with XHTML
CSS Layouts: Grouping Elements
Webpage layout using CSS
Floating & Positioning
Web Development & Design Foundations with HTML5 7th Edition
Chapter 7 Page Layout Basics Key Concepts
Web Development & Design Foundations with HTML5 8th Edition
The Internet 10/25/11 XHTML Tables
Basics of Web Design Chapter 7 Page Layout Basics Key Concepts
6 Layout.
Creating Layouts Using CSS
MORE Cascading Style Sheets (The Positioning Model)
DynamicHTML Cascading Style Sheet Internet Technology.
Web Development & Design Foundations with H T M L 5
DynamicHTML Cascading Style Sheet Internet Technology.
Floating and Positioning
Web Development & Design Foundations with XHTML
Laying out Elements with CSS
The Internet 10/20/11 CSS Layout
CSc 337 Lecture 5: Grid layout.
Positioning Boxes Using CSS
CGS 3066: Web Programming and Design Fall 2019 CSS Part 2
Presentation transcript:

Cascading Style Sheets (CSS) Part II IT210: Web-based IT

Some slides modified based upon Charles Severance’s Creative Common’s Licensed CSS intro slides available in full here: CSS.ppt CSS.ppt

A Slight Diversion

Microformats A microformat is a web-based approach to semantic markup that seeks to re-use existing HTML/XHTML tags to convey metadata and other attributes in web pages... (Wikipedia) In other words, microformats are standards for using agreed upon “class” names for specific things like geographic coordinates, recipe ingredients, phone numbers…

Recipe Microformats

CSS Positioning

Every CSS element in a document is considered to be a rectangular box

The Box Model

CSS Box Model Properties 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

Two kinds of boxes (i.e. elements) Inline - affects how text looks EM, SPAN, actual text or images Block - Containers that can be laid out P, DIV, TABLE, etc CSS can change a tag from inline to block using the “display” property #navigation li { display: inline; }

Inline Elements Flowed with other text span, em, strong, cite, a Inline tags can be nested as long as they are both inline 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

A block contained inside a block

Positioning/Layout Methods Normal Flow (i.e., static positioning) = default Relative (“shifted” from normal flow position) Absolute (position specified; scrolls as usual) Fixed (position specified; doesn’t scroll) Floating (floats to a side; content wraps around it)

Normal Flow of Block-level elements = vertical Note the collapsed Margins!

Normal Flow of In-line elements = horizontal (with wrapping)

Relative Positioning Overlaps are allowed! Original space of box is still taken up! p { position:relative; left:20px; top:25x; }

Absolute Positioning Treated as block-level elements Removed from normal flow & can overlap other elements p { position:absolute; left:20px; top:25x; }

Fixed Positioning Same as Absolute Positioning except the element does not move when scrolling p { position:fixed; left:20px; top:25x; }

Floats Floated elements are treated like blocks even if they are inline elements span { float:right; width:200px }

Adjacent Floats Multiple floated elements stack horizontally (unless you use the clear property to stack them vertically)

CSS Resources

CSS Validation You can validate your CSS to make sure it has no syntax errors Browsers will generally quietly ignore bad CSS syntax The validator can save you time and sanity Source: W3C

Browser CSS Charts *Look into Quirks & Strict mode if you’re designing for old browsers