CSS Class 2 -Add margins to elements on a page. -Set width and height of elements. - CSS shorthand properties for box model. -Style links. -Style tables.

Slides:



Advertisements
Similar presentations
LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties-- List properties –Table properties-- Classification properties.
Advertisements

LIS650 lecture 4 Thomas Krichel today Advice CSS Properties –Box properties –List properties –Classification properties Fun with selectors.
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.
Principles of Web Design 5 th Edition Chapter Nine Site Navigation.
© 2004, Robert K. Moniot Chapter 6 CSS : Cascading Style Sheets.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
Client-Side Internet and Web Programming
CIS 1310 – HTML & CSS 6 Layout. CIS 1310 – HTML & CSS Learning Outcomes  Describe & Apply the CSS Box Model  Configure Float with CSS  Designate Positioning.
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} //
กระบวนวิชา 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.
© 2010, Robert K. Moniot Chapter 5 CSS : Cascading Style Sheets 1.
Tutorial 4 Formatting Text. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Create a spread heading Indent text Change the line spacing.
Cascading Style Sheets Part 3 Fall, 2007 Modified by Linda Kenney Nov. 12, 2007.
Chapter 9. Links  When styling a link, you must tell CSS both what you want to style, and when you want the style to happen  Web browsers keep track.
Cascading Style Sheets Cyndi Hageman. Applying a Style Sheet  In-line style – used within the HTML tag  Embedded Style Sheet – located in the HTML document.
CSS: Cascading Style Sheets. 2 History HTML tags were originally designed to define the content of a document. The layout of the document was supposed.
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.
Page Layout & Mobile Web Using columns, grid systems, etc… to layout sites for desktops and mobile.
Cascading Style Sheets CS3505. What are CSS? Method for adding style attributes consistently to HML tags Cascading because styles are applied in order.
CSS Dvijesh Bhatt.
WORKING WITH CASCADING
New Perspectives on XML, 2nd Edition Tutorial 5 1 TUTORIAL 5 WORKING WITH CASCADING STYLE SHEETS.
XP New Perspectives on XML Tutorial 5 1 TUTORIAL 5 CSS Tutorial – Carey ISBN
WDV 101 Intro to Website Development
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Doman’s Sections Information in this presentation includes text and images from
Website Development & Management Working with Style Rules Instructor: John Seydel, Ph.D. CIT Fall
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
Today’s objectives  Assignment 1  Padding, Margins, Borders  Fluid Layout page  Building accessible Table  Element size with padding and border 
Tutorial #4 Formatting Text and Links. Tutorial #3 Review - CSS CSS format Selector { property1: value1; /* Comments */ } Embedded, In-Line, and External.
LITTLE BOXES Controlling size of boxes Box model for borders, margin and padding Displaying and hiding boxes.
Doncho Minkov Telerik Web Design Course html5course.telerik.com Technical Trainer
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.
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
INTRODUCTORY Tutorial 4 Exploring Graphic Elements and Images.
>> The “Box” Model. Pre-requisite Create a new project in Netbeans called Week5 Create a new html file and name it box.html Create a new css file and.
 Cascading Style Sheets (CSS) ◦ Used to specify the presentation of elements separately from the structure of the document.  Inline style ◦ declare.
Week 8 – Part 2 Page Layout Basics Key Concepts 1.
Principles of Web Design 6 th Edition Chapter 9 – Site Navigation.
Web Development & Design Foundations with HTML5 7th Edition
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
CSS Fun damentals The Document Hierarchy Element Relationships The Box Model.
3.2 Cascading Style Sheets. 2 Positioning Elements Normally, elements are laid out on the page in the order that they are defined in the XHTML document.
Copyright © Osmosys O S M O S Y SO S M O S Y S D e p l o y i n g E x p e r i e n c e & E x p e r t i s e™ CSS Training.
©SoftMoore ConsultingSlide 1 Introduction to HTML: Cascading Style Sheets.
CONTROLLING Page layout
IS1825 Multimedia Development for Internet Applications Lecture 12: IDs, Classes and Internal CSS Rob Gleasure
CSS: Cascading Style Sheets Part II. Style Syntax.
Tutorial 3 Designing a Web Page with CSS
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
Chapter 7.  Change body and link styles  Create a drop-down menu  Change color and font styles in the menu  Create a pop-up effect using CSS  Utilize.
Welcome To Website Design, Hosting And Management Prepared By Webdev Solution ip ,223,96.
Unit 3 - Review. Topics 1. Tag, Attribute, Value 2. CSS Rule Syntax + link 3. Categories of Selectors 4. Inline vs Block Tags 5. CSS Layout 6. CSS Box.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 4 Formatting Text and Links.
NAVIGATION USING HTML TO SET UP THE BASIC STRUCTURE OF A NAV BAR.
1 Cascading Style Sheets
WebD Introduction to CSS By Manik Rastogi.
CSS: Cascading Style Sheets
Cascading Style Sheet List Properties Box Properties Pseudoclass
Chapter 7 Page Layout Basics Key Concepts
Web Development & Design Foundations with HTML5 8th Edition
The Internet 10/25/11 XHTML Tables
Cascading Style Sheets
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Cascading Style Sheet List Properties Box Properties Pseudoclass
Basics of Web Design Chapter 7 Page Layout Basics Key Concepts
List Properties Box Properties Pseudoclass
CS3220 Web and Internet Programming More CSS
Presentation transcript:

CSS Class 2 -Add margins to elements on a page. -Set width and height of elements. - CSS shorthand properties for box model. -Style links. -Style tables. -Replace bullets on a list. -Control indentation of lists.

Review Definition Block element: –Has a space above and below it on the page

Add Margins to Elements on a Page margin

What the Margin Does Defines area outside the box Separates elements from one another on the page

Here’s Someone Who is Annoyed About a Margin

How to Set Margins Margin-top, margin-bottom, Margin-left, and margin right Set margins the same as padding. Use any unit, but px most common Always provide unit of measurement except when setting for “0”

Margins and Paragraphs With vertical margins, they will collapse into each other (see p. 305) With horizontal, the distance between two paragraphs is: –Top margin of lower paragraph –Bottom margin of upper paragraph If you are trying to eliminate space, you must work with both. Solution is to set to 0

Set Width & Height of Elements

By default, most block elements are set to a width of 100% of their parent element –An element that is the direct child of the body will have a width of 100% of the body –It will stretch across the browser window Table cells are set to a width that is a calculation of the minimum width needed to display cell content and the width needed to make up its part of the width of the table’s row

CSS to the Rescue Width property allows designers to override the default setting and specify a width to be used by the element All valid units of measurement allowed Most often: –Px used to set exact widths –Percentages to allow the element flexibility to expand or collapse based on the width of browser window

Caution on Setting Height Element heights are usually as big as needed to fit contents CSS has height property to offer more control Why: –If you use percentage for the width, the height of text will vary depending on browser’s width –Setting height in this case can result in a large empty space at bottom of element’s block (on some browsers) –Designers often avoid setting height

Style Links Concept of pseudo-, as in pseudo-class and pseudo-elements What is pseudo-class? –A CSS special selector that exists for styling links in a certain order of state –That states are: –link, visited, hover, active

States Defined Link when first visited Visited when link has already been clicked Hover when mouse is over it Active when it is being clicked

Syntax for Using Pseudo-elements a:link { font-weight: bold; color: #5e7630; text-decoration: none; padding-left: 3px; padding-right: 3px; }

Syntax for Visited a:visited { font-weight: bold; color: #5e7630; text-decoration: none; padding-left: 3px; padding-right: 3px;

Syntax for Hover a:hover { color: #000; background-color: #5e7630; text-decoration: underline ; }

Syntax for Active a:active { background-color: #fff; }

Text Decoration none underline overline line-through

Text Decoration, cont. None hides the underline Underline brings it back

Style Tables

Inheritance Every table is made up of: –table –tr –td

Nesting & Inheritance Tr has to be nested within table: –Therefore all properties that apply to former apply to latter Same applies to td but it inherits from table and tr Add in thead, tfoot, tbody Region Number of Parks States/Territories in Region Total Regions: 7; Total Parks: 482

Setting Borders Special effect with border –Set to 50 px –Set color to blue for top and bottom –Set color to red for left and right

Replace Bullets on List

CSS List Styling Properties List-style-type allows change to default appearance of bullet Examples: –None –Disc –Circle –Square –Decimal List-style-image allows for replacement of bullet with image Image must be small or line height will increase Overcome inheritance with list-style- image changed to none

Why Use Ugly Bullets?Bullets

Control Indentation of Lists By default, unordered and ordered lists indent the individual items li is a block element, so indentation can be controlled by setting the padding or margin To achieve consistency across browsers, you must set margin-left and padding-left to the same value (set at ul or ol level, not ea. Ind’l item)

Long List Items & Hanging Indents When the list item is long, to where does it wrap? Annoying if it wraps to the margin Good news: it doesn’t. By default, it wraps to align with the top item, not the bullet or number

Change by… Using list-style-position property Sets to inside Makes the bullet or number an inline element within the list item Since property is inherited from nested list, override it later by setting list-style- position to outside