JavaScript and CSS

Slides:



Advertisements
Similar presentations
With CSS, a color is most often specified by: a HEX value - like "#ff0000" an RGB value - like "rgb(255,0,0)" a color name - like "red“ Example h1.
Advertisements

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.
CSS: Class 1 Background Images, Controlling Position of Background Images, Add Padding to Page Elements, Add Borders to Elements on a Page.
Working with Cascading Style Sheets
方框的CSS樣式.
CSS Properties  Font  Color & Background  Text  List  Box Model  Visual Formatting Model (normal & float)  User Interface & Downloadable Font 
Cascading Style Sheets (Formatting. Slide 2 Lecture Overview At this point, you have learned how and where to create styles You have not learned much.
CASCADING STYLE SHEETS CSS. 2 What CSS means?  CSS is an extension to basic HTML that allows you to style your web pages.  It separates the part that.
Basics of Web Design Chapter 6 More CSS Basics Key Concepts 1.
Text Properties, Line Box, CSS. Text Properties Properties related to the display of text. Text-align : left, right, center I like FSU!
TUTORIAL 4: CREATING PAGE LAYOUT WITH CSS Session 4.3.
Tutorial 3 Working with Cascading Style Sheets. XP Objectives Review the history and concepts of CSS Explore inline styles, embedded styles, and external.
Intro to Cascading Style Sheets IS 373—Web Standards Todd Will.
CSS to Know And this is just the beginning. What to What?  Tags = regular HTML  Ids = #id, only one hashtag per page  Class =.class, many as you want.
Cascading Style Sheets – Block Level. Block Level Style So far we have done text-level CSS With block level CSS, we used a generic container tag Similarly.
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.
Cascading Style Sheets CS3505. What are CSS? Method for adding style attributes consistently to HML tags Cascading because styles are applied in order.
Cascading Style Sheets Billy Toy Cascading Style Sheets Syntax review How to Implement style sheets Background properties Text properties.
Cascading Style Sheets, pt 2 ECA 225 Applied Online Programming.
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
Tutorial 3 Working with Cascading Style Sheets (CSS)
Doman’s Sections Information in this presentation includes text and images from
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 My favourite ICT lesson By Federico Boschi Cascading Style Sheets.
CSS - Cascading Style Sheets. What is CSS ? css defines how to display an html document (fonts, colors, layouts etc.) were added to HTML 4.0 specification.
Lecture # 33 Cascade Style Sheets (CSS). Cascade Style Sheets (CSS): Preserving a consistent “look and feel” of a website across multiple pages.
Cascading Style Sheet Bayu Priyambadha, S.Kom. Definition Cascading Style Sheets (CSS) form the presentation layer of the user interface. –Structure (HTML)
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 10: A Deeper Look at CCS- Spring 2011.
CHAPTER 3 CSS & CSS3 อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
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.
COMP213 – Web Interface Design
LITTLE BOXES Controlling size of boxes Box model for borders, margin and padding Displaying and hiding boxes.
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.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
>> 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.
Cascading Style Sheets Eugenia Fernandez IUPUI. CSS Purpose CSS allow you to specify the style in which your XML elements are displayed. CSS were originally.
XP Review 2 New Perspectives on JavaScript, Comprehensive1 Introducing Cascading Style Sheets Formatting Web Pages with CSS.
1 Introduction to Web Application Introduction to Cascading Style Sheet.
CSS Presentation CSS Typography, Fonts, Spacing, Borders, Backgrounds, Opacity Svetlin Nakov Technical Trainer Software University
1 CS428 Web Engineering Lecture 08 Border, Margin, Padding … (CSS - III)
Copyright © 2006, Jumail, FSKSM, UTM Slide 1 Cascading Style Sheets (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:
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.
©SoftMoore ConsultingSlide 1 Introduction to HTML: Cascading Style Sheets.
CSS – Cascading Style Sheets
Cascading Style Sheets Web Design Fairport High School.
CSS properties Basharat Mahmood, Department of Computer Science, CIIT, Islamabad, Pakistan 1.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
CSE 154 LECTURE 4: PAGE SECTIONS AND THE CSS BOX MODEL.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring 2016 CSS Positioning 1.
HTML and Dreamweaver November 11th. Agenda Box Model Displaying and positioning elements – Padding – Margin – Float – Display – Position HTML Demo.
Review First – on your own... Go to Day 5 Grab the contents of position review file Place in DW Add styles to recreate – get something close to
Cascading Style Sheet (CSS) SAMPLE IT133 Pengembangan Web.
CSS Box Model. What is the Box Model? Each XHTML element appearing on our page takes up a "box" or "container" of space. Each box size is affected not.
Introduction To CSS. History of CSS ► ► CSS was proposed in 1994 as a web styling language. To helps solve some of the problems HTML 4. ► ► There were.
ECA 228 Internet/Intranet Design I Cascading Style Sheets.
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,
PERSPECTIVES: TUTORIAL 4 CREATING PAGE LAYOUTS WITH CSS.
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
1 CS428 Web Engineering Lecture 07 Font, Text & Background (CSS - II)
Welcome To Website Design, Hosting And Management Prepared By Webdev Solution ip ,223,96.
CIS 4004: Web Based IT (CSS) Page 1 © Dr. Mark Llewellyn CIS 4004: Web Based Information Technology Fall 2012 Cascading Style Sheets (CSS) Department of.
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,
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.
LEARNING CSS Techieweb Solutions Techieweb solutions.
CSS.
Presentation transcript:

JavaScript and CSS

style  使用 style 物件存取 css 屬性 : document.getElementById(" id ").style. property =" value ";  所有屬性值都是字串型態。  Style object property categories:  Background Background  Border and Margin Border and Margin  Layout Layout  List List  Positioning Positioning  Table Table  Text Text

Examples div1= document.getElementById("content"); div1.style.width = "800px"; div1.style.padding = "10px 20px 0px"; div.style.backgroundColor="#ccf"; div.style.fontSize=“2.5em”; div1.style.fontSize=(parseFloat(div.style.fontSize)*1.2)+"em"; div1.style.width = (parseInt(div1.style.width)+50)+"px"; div1.style.width +=50; // 錯誤 !

Examples img1.style.opacity=1.0; img2.style.opacity=0.0; … function imgShow() { o1 = parseFloat(img1.style.opacity); o2 = parseFloat(img2.style.opacity); o1 -= 0.02; o2 += 0.02; img1.style.opacity=o1; img2.style.opacity = o2; if (o1>0) window.setTimeout("imgShow()", 200); }

CSS 屬性名稱對應 CSS 屬性名稱 style. property (JavaScript ) width font-sizefontSize border-top-styleborderTopStyle padding-leftpaddingLeft floatcssFloat

Background PropertyDescription background Sets all background properties in one backgroundAttachm ent Sets whether a background-image is fixed or scrolls with the page backgroundColor Sets the background-color of an element backgroundImage Sets the background-image of an element backgroundRepeat Sets if/how a background-image will be repeated

Border and Margin borderborder borderTop borderRight borderBottom borderLeftborderTopborderRightborderBottomborderLeft borderColorborderColor borderTopColor borderRightColor borderBottomColor borderLeftColorborderTopColorborderRightColorborderBottomColorborderLeftColor borderStyleborderStyle borderTopStyle borderRightStyle borderBottomStyle borderLeftStyleborderTopStyleborderRightStyleborderBottomStyleborderLeftStyle borderWidthborderWidth borderTopWidth borderRightWidth borderBottomWidth borderLeftWidthborderTopWidthborderRightWidthborderBottomWidthborderLeftWidth marginmargin marginTop marginRight marginBottom marginLeftmarginTopmarginRightmarginBottommarginLeft paddingpadding paddingTop paddingRight paddingBottom paddingLeftpaddingToppaddingRightpaddingBottompaddingLeft

Layout PropertyDescription clear Sets on which sides of an element other floating elements are not allowed clip Sets the shape of an element cssFloat Sets where an image or a text will appear (float) in another element cursor Sets the type of cursor to be displayed direction Sets the text direction of an element display Sets how an element will be displayed height Sets the height of an element maxHeight Sets the maximum height of an element maxWidth Sets the maximum width of an element minHeight Sets the minimum height of an element minWidth Sets the minimum width of an element overflow Specifies what to do with content that does not fit in an element box verticalAlign Sets the vertical alignment of content in an element visibility Sets whether or not an element should be visible width Sets the width of an element

var cardPool=document.getElementById(“cardPool”); document.getElementById("btnStart").onclick=start; document.getElementById("btnStop").onclick=stop; cardPool.style.display="none"; … function start() { cardPool.style.display=“block"; … } function stop() { cardPool.style.display="none"; } for (var i=0;i<5;i++) document.write(" ");

List PropertyDescription listStyleSets all the properties for a list in one listStyleImageSets an image as the list-item marker listStylePositionPositions the list-item marker listStyleTypeSets the list-item marker type

Positioning PropertyDescription bottomSets how far the bottom edge of an element is above/below the bottom edge of the parent element leftSets how far the left edge of an element is to the right/left of the left edge of the parent element positionPlaces an element in a static, relative, absolute or fixed position rightSets how far the right edge of an element is to the left/right of the right edge of the parent element topSets how far the top edge of an element is above/below the top edge of the parent element zIndexSets the stack order of an element

Table PropertyDescription borderCollapseSets whether the table border are collapsed into a single border or detached as in standard HTML borderSpacingSets the distance that separates cell borders emptyCellsSets whether or not to show empty cells in a table

Text Property Description color Sets the color of the text font Sets all font properties in one fontFamily Sets the font of an element fontSize Sets the font-size of an element fontStyle Sets the font-style of an element fontVariant Displays text in a small-caps font fontWeight Sets the boldness of the font letterSpacing Sets the space between characters lineHeight Sets the distance between lines textAlign Aligns the text textDecoration Sets the decoration of a text textIndent Indents the first line of text textTransform Sets capitalization effect on a text whiteSpace Sets how to handle line-breaks and white-space in a text wordSpacing Sets the space between words in a text