Style sheets can also affect the body. style4.css body {background-color : white} h1 {color : red; font-size : 50; font-family : arial} h2 {color : green}

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

HTML and CSS. HTML Hyper Text Markup Language Tells browser how to display text and images.
Web Engineering 1 Ishaq Khan Shinwari MCS City University Peshawar.
1 Cascading Style Sheets Continued Different kinds of selectors in a style sheet –Simple- Pseudo-Class –Contextual- Pseudo-Element –Class Image Styles.
CSS. Intro to CSS Cascading Style Sheets – styles and enhances appearance of webpage.css extension.
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.
Cascading Style Sheets By: Valerie Kuna. What are Cascading Style Sheets? Cascading Style Sheets (CSS) are a standard for specifying the presentation.
กระบวนวิชา 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.
Measurement Many CSS properties (values within the declaration) require that you specify a unit of measurement, such as spacing between elements, border.
Cascading Style Sheets Color and Background Controls Border and Margin Controls (Boxes)
Week 9 Using the Box Properties. 9-2 The CSS Visual Formatting Model Describes how the element content boxes should be displayed by the browser –Based.
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.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
The Comment tag Many programming languages allow us to write comments in a program Comments are ignored by the computer when processing the program but.
Style Sheets: the right way to specify rendering.
CSE CASCADING STYLE SHEETS CSS Faculty of Computer Science and Engineering.
Different Box elements All our examples to date have been shown in terms of the box for H1 elements Many other elements also have a box, including H2 elements.
Style sheets can also affect the BODY. style4.css BODY {BACKGROUND-COLOR : white} H1 {COLOR : red; FONT-SIZE : 50; FONT-FAMILY : arial} H2 {COLOR : green}
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.
Cascading Style Sheets 1 Color and Backgrounds. Cascading Style Sheets 2 Color and Backgrounds Computer color basics Expression of color values using.
CSS Dvijesh Bhatt.
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.
Cascading Style Sheets CSS. CSS - Structure Declaration block Property: identifies what to change Value: how to change it Selector – example h1{ font-size:
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
1 Cascading Style Sheets (CSS) Part 2. 2 The Sources of Style Sheets.
CSS The Definitive Guide Chapter 8.  Allows one to define borders for  paragraphs  headings  divs  anchors  images  and more.
 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.
CIS 1315 – Web Development for Educators CIS 1315 HTML Tutorials 3 & 4: Working With CSS.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 7.
Introduction to CSS. What is CSS?  Cascading Style Sheets  Used for styling HTML  Also important in javascript and jquery for selectors  External.
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.
CSS Tutorial 1 Introduction Syntax How to use style specifications. Styles.
 2008 Pearson Education, Inc. All rights reserved Cascading Style Sheets™ (CSS)
Chcslonline.org Text –wrapping around Images. chcslonline.org To wrap text around an image, lets set up a style in our style sheet. open a new notepad.
INTRODUCTORY Tutorial 4 Exploring Graphic Elements and Images.
Creating Your Own Webpage COSC Cascading Stylesheets Think of: HTML: content of your webpage HTML has tags CSS: presentation and appearance of your.
Cascading Style Sheets Chapters 5-6 Color and Background Controls Border and Margin Controls.
>> 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.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
CIS234A Lecture 5 Instructor Greg D’Andrea. Font Styles Review Font-Family: generic family, font family Font-Size: em, pt, px, %, mm, cm, in Font-Style:
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
Tutorial 4 Creating Page Layouts with CSS
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.
Tutorial #5 Working with the Box Model. Tutorial #4 Review - CSS Create a homework page Final Project Discussion Exam on Blackboard Styling Lists (List-style-type,
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.
Blended HTML and CSS Fundamentals 3 rd EDITION Tutorial 3 Introducing Cascading Style Sheets.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
HTML & CSS Contents: the different ways we can use to apply CSS to The HTML documents CSS Colors and Background CSS Fonts CSS Text CSS box model: padding,
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.
WebD Introduction to CSS By Manik Rastogi.
CSS.
Cascading Style Sheets™ (CSS)
( Cascading style sheet )
Creating Your Own Webpage
>> The “Box” Model
Cascading Style Sheets (Formatting)
IS333: MULTI-TIER APPLICATION DEVELOPMENT
Cascading Style Sheets
The Internet 10/13/11 The Box Model
CSS Borders and Margins.
Second CSS Lecture Applications to XML
How to use the CSS box model for spacing, borders, and backgrounds
Cascading Style sheet. What is CSS?  CSS stands for Cascading Style Sheets  Cascading: refers to the procedure that determines which style will apply.
Cascading Style Sheets™ (CSS)
Presentation transcript:

Style sheets can also affect the body

style4.css body {background-color : white} h1 {color : red; font-size : 50; font-family : arial} h2 {color : green} p {color : blue}

Appying style4.css to wars2.htm

Notice carefully: The html language is evolving This means, unfortunately, that it is not as elegant as it could be A defect is that there are inconsistencies between various generations of the language Remember BGcolor from last lecture -- I said you should not use it because –In style sheets, the same effect is achieved with background-color

font-style

style5.css body {background-color : white} h1 {color : red; font-size : 50; font-family : arial} h2 {color : green ; font-style : italic} p {color : blue}

Applying style5.css to wars2.htm

Summary so far: A style sheet comprises a sequence of one or more items of this type: selector { declaration } The selector specifies a type of logical item whose rendering we want to control The declaration specifies the rendering

Summary (contd.) The types of logical item that can be selected by a selector include body, p, h1, h2, H3, … and more that we will consider later The way in which we can control rendering depends on the type of logical item we have selected to render -- we will consider the possibilities later

Places to specify style sheets In a separate file and called by a LINK (this makes a style sheet available for lots of documents) Within the head of a document, but this restricts its usage to the parent document Embedded within the body content of a document -- there are only rare situations where this is needed or desirable

in-HEAD style sheets An in-HEAD style sheet must be delimited by a pair of tags: and Example: Wars of the 20th Century body {background-color : white} h1 {color : red ; font-size : 50 ; font-family : arial} h2 {color : green ; font-style : italic} p {color : blue}....

Prioritization (Cascading) More specific style specifications override more general ones If you use linked, head and in-body style sheets, in-body is given first preference, then head then linked sheets A style for a child element overrides one for its parent/ancestor

Logical items and their “boxes” Most logical items can be regarded as being placed, by the browser, in a “box”

Boxes and their contents A box has various attributes, such as –empty margin outside the box, border of the box, padding between border of the box and its content, background of the box These attributes can be controlled The content of a box has attributes, such as color, font, spacing, alignment, decoration, indentation, transformation, and others These attributes can be controlled

Controlling Box attributes A box has a BORDER A border has a style which can have the following values: –none, dotted, dashed, solid, double, groove, ridge, inset and outset –none is the default value Not all browsers may support all values of the style, displaying many of them as if they were solid

Box BORDER contd. A border has a WIDTH which can be specified in various ways, including giving a value in inches

Box BORDER contd. Now that we have a thick BORDER, we can see the effect of style more clearly

Box BORDER contd. A BORDER has a TOP, BOTTOM, LEFT and RIGHT, whose WIDTH and style can be set separately

Box BORDER contd. A BORDER has a color but we cannot give different sides of the border different colours

Box PADDING We can control the PADDING between the BORDER of a box and its content We can control separately the PADDING on the TOP, BOTTOM, LEFT and RIGHT of the box

Box PADDING Of course, we can just specify a PADDING that we want on all four sides

Box MARGIN We can control the MARGIN of clear space which exists outside a box

Box MARGIN We can control separately the MARGIN outside the TOP, BOTTOM, LEFT and RIGHT of a box

Box BACKGROUND A box has a foreground (the content of the box) and a BACKGROUND We can control the appearance of the BACKGROUND, by specifying its color or by controlling the use of an IMAGE as the basis of the background

BACKGROUND IMAGE We specify the image which is to be used as the basis of the BACKGROUND by giving its url, which, of course, can be a relative or an absolute url The specified image is used as a tile to cover the BACKGROUND

BACKGROUND IMAGE contd. We can specify the POSITION, relative to the top left corner of the box, where we want tiling to start We can specify the POSITION –symbolically –using percentages –using absolute coordinates

BACKGROUND IMAGE contd. Specifying a POSITION symbolically: –use left, center or right for horizontal positioning –use top, center or bottom for vertical positioning

BACKGROUND IMAGE contd. We specify a POSITION absolutely by using coordinates, specified in our favourite units, from the top-left corner of the box

BACKGROUND IMAGE contd. We specify a POSITION in percentage terms by specifying the percentage of the box height down from the top and the percentage of the box width in from the left that we want tiling to start

BACKGROUND IMAGE contd. We can also control the form of REPEAT used in the tiling, using one of the three values: repeat, repeat-x repeat-y