More CSS CS380 1. HTML id attribute 2 Coding Horror! Our mission is to combine programming and “human” factors with geekiness! output  A unique ID for.

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

Web Engineering 1 Ishaq Khan Shinwari MCS City University Peshawar.
Cascading Style Sheets
Cascading Style Sheets
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Layout using CSS. Using multiple classes In the head:.important{font-style:italic;}.title{color:red;} In the body: Here's a type of paragraph that is.
CSS Digital Media: Communication and design 2007.
Today CSS HTML A project.
Introducing CSS CIS 133 mashup Javascript, jQuery and XML 1.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Very quick intro HTML and CSS. Sample html A Web Title.
Cascading Style Sheets (CSS): Pixel-Level Control with HTML Ease
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.
Links.  Styling Links  Links can be styled with any CSS property (e.g. color, font-family, background-color).  Special for links are that they can.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
1 Web Developer & Design Foundations with XHTML Chapter 9 Key Concepts.
End User Computing An Introduction to CSS Sujana Jyothi Research Lab1, Callan Building, Department of Computer Science
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
CSS BASICS. CSS Rules Components of a CSS Rule  Selector: Part of the rule that targets an element to be styled  Declaration: Two or more parts: a.
Building a Website: Cascading Style Sheets (CSS) Fall 2013.
Client-Side Internet and Web Programming
1 Pengantar Teknologi Internet W03: CSS Cascading Style Sheets.
Recognizing the Benefits of Using CSS 1. The Evolution of CSS CSS was developed to standardize display information CSS was slow to be supported by browsers.
CSS(Cascading Style Sheets )
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
กระบวนวิชา 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.
Unit 20 - Client Side Customisation of Web Pages
CSS normally control the html elements. Three Ways to Insert CSS There are three ways of inserting a style sheet: External style sheet Internal style.
Basics CSS Chapter 3 and chapter 4 Page Sections and the CSS Box Model 1.
Dreamweaver -- CSS. Dreamweaver -- MX New icons are added in MX Most of the features commonly used in web design, and are same as FrontPage. New feature.
CSS The Definitive Guide Chapter 8.  Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more.
CSS Border.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
>> 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.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, you will learn:  CSS Box Model  CSS properties for border  CSS properties for.
CSE 154 LECTURE 4: PAGE SECTIONS AND THE CSS BOX MODEL.
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.
WebD Introduction to CSS By Manik Rastogi.
Cascading Style Sheets Boxes
Cascading Style Sheets™ (CSS)
( Cascading style sheet )
Semester - Review.
CSS Layouts: Grouping Elements
Unit 3 - Review.
Creating Your Own Webpage
UNIT-II CSS.
CS1220 Web Programming Saloni Chacha.
>> The “Box” Model
Cascading Style Sheets (Layout)
Cascading Style Sheet (CSS)
CSS Applications to XML 19-Sep-18.
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Introduction to Web programming
The Internet 10/13/11 The Box Model
CSS Borders and Margins.
Lecture 4: Page Sections and the CSS Box Model
Second CSS Lecture Applications to XML
Lecture 4: Page Sections and the CSS Box Model
How to use the CSS box model for spacing, borders, and backgrounds
More CSS 22-Feb-19.
Lecture 3: Page Sections and More CSS
Cascading Style sheet. What is CSS?  CSS stands for Cascading Style Sheets  Cascading: refers to the procedure that determines which style will apply.
CMPT241 Web Programming More CSS: Page Layout.
CSS Boxes CS 1150 Fall 2016.
CS3220 Web and Internet Programming More CSS
CSS Applications to XML 20-May-19.
CSS Applications to XML 3-Jul-19.
Cascading Style Sheets™ (CSS)
Presentation transcript:

More CSS CS380 1

HTML id attribute 2 Coding Horror! Our mission is to combine programming and “human” factors with geekiness! output  A unique ID for an element on a page  Each ID must be unique; can only be used once in the page CS380 Coding Horror! Coding Horror! Our mission is to combine programming and human factors with geekiness! HTML

Linking to sections of a web page 3 Visit textpad.com to get the TextPad editor.textpad.com View our Mission Statement View our Mission Statement output  Link target can include an ID at the end, preceded by a #  Browser will load that page and scroll to element with given ID CS380 Visit <a href= " textpad.com to get the TextPad editor. View our Mission Statement HTML

CSS ID selectors 4 #mission { font-style: italic; font-family: "Garamond", "Century Gothic", serif; } CSS  Applies style only to the paragraph that has the ID of mission CS380 Coding Horror! Coding Horror Our mission is to combine programming and “human” factors with geekiness! output

HTML class attribute 5 Coding Horror! See our special deal on Droids! Today only! output  A way to group some elements and give a style to only that group  Unlike an id, a class can be reused as much as you like on the page CS380 Coding Horror! Coding Horror! See our special deal on Droids! Today only! HTML

CSS class selectors 6 Coding Horror! output CS380.special { background-color: yellow; font-weight: bold; } p.shout { color: red; font-family: cursive; } CSS See our special deal on Droids! Today only!

CSS class selectors 7 Coding Horror! output CS380 See our special deal on Droids! Today only! Coding Horror! Coding Horror! See our special deal on Droids! Today only! HTML

CSS ID selectors 8 a:link { color: #FF0000; } /* unvisited link */ a:visited { color: #00FF00; } /* visited link */ a:hover { color: #FF00FF; } /* mouse over link */ CSS CS380 Buy Early Buy OftenBuy Early Buy Often! output

CSS ID selectors 9 CS380

Styling Page Sections 10 CS380

Why do we need page sections?  Style individual elements, groups of elements, sections of text or of the page  Create complex page layouts CS380 11

Sections of a page 12 Coding Horror! We’ll beat any advertised price! output  Tag used to indicate a logical section or area of a page  Has no appearance by default, but you can apply styles to it CS380 Coding Horror! Coding Horror! See our special deal on Droids! We'll beat any advertised price! HTML See our special deal on Droids!

Inline Sections 13 Coding Horror! See our spectacular deal on Droids! We’ll beat any advertised price! output  has no onscreen appearance, but you can apply a style or ID to it, which will be applied to the text inside the span CS380 Coding Horror! Coding Horror! See our spectacular deal on Droids! We'll beat any advertised price ! HTML

CSS context selectors 14 CS380 selector1 selector2 { properties } CSS  applies the given properties to selector2 only if it is inside a selector1 on the page selector1 > selector2 { properties } CSS  applies the given properties to selector2 only if it is directly inside a selector1 on the page

Context selector example 15 Eat at Greasy’s Burger… The greasiest burgers in town! Yummy and greasy at the same time! output CS380 Eat at Greasy's Burger... The greasiest burgers in town! Yummy and greasy at the same time! HTML li strong { text-decoration: underline; } CSS

More complex example 16 Eat at Greasy’s Burger… The greasiest burgers in town! Yummy and greasy at the same time! output CS380 Eat at Greasy's Burger... The greasiest burgers in town! Yummy and greasy at the same time ! HTML #ad li.important strong { text-decoration: underline; } CSS

The CSS Box Model  Every element composed of:  content  a border around the element  padding between the content and the border  a margin between the border and other content CS380 17

The CSS Box Model (cont.)  width = content width + L/R padding + L/R border + L/R margin  height = content height + T/B padding + T/B border + T/B margin  IE6 doesn't do this right CS380 18

Document Flow – block elements CS380 19

Document flow - inline elements CS380 20

Document flow - a larger example CS380 21

CSS properties for borders 22 output h2 { border: 5px solid red; } CSS This is a heading.  Thickness: px, pt, em, or thin, medium, thick  Style: none, hidden, dotted, dashed, double, groove, inset, outset, ridge, solid  color

More border properties 23

Another border example 24 output h2 { border-left: thick dotted #CC0088; border-bottom-color: rgb(0, 128, 128); border-bottom-style: double; } CSS This is a heading.  each side's border properties can be set individually  if you omit some properties, they receive default CS380

CSS properties for padding CS380 25

Padding example 1 26 This is a first paragraph. This is a second paragraph. output p { padding: 20px; border: 3px solid black; } h2 { padding: 0px; background-color: yellow; } CSS CS380 This is a heading

Padding example 2 27 This is a first paragraph. output p { padding-left: 200px; padding-top: 30px; background-color: fuchsia; } CSS This is a first paragraph This is a second paragraph  each side's padding can be set individually  notice that padding shares the background color of the element

CSS properties for margins CS380 28

Margin example 1 29 output p { margin: 50px; background-color: fuchsia; } CSS  notice that margins are always transparent This is a second paragraph This is a first paragraph CS380

Margin example 2 30 output p { margin-left: 8em; background-color: fuchsia; } CSS  each side's margin can be set individually This is a second paragraph This is a first paragraph CS380

CSS properties for dimensions 31 output p { width: 350px; background-color: yellow; } h2 { width: 50%; background-color: aqua; } CSS An h2 heading This paragraph uses the first style above

Centering a block element: auto margins 32 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. output p { margin-left: auto; margin-right: auto; width: 750px; } CSS  works best if width is set (otherwise, may occupy entire width of page)  to center inline elements within a block element, use text- align: center; CS380