Dawn Pedersen Art Institute. What Are CSS Sprites? Back in the day, sprites were the images in games that swapped one little image for another in a specific.

Slides:



Advertisements
Similar presentations
Introduction to Web Design Lecture number:. Todays Aim: Introduction to Web-designing and how its done. Modelling websites in HTML.
Advertisements

2.744 Dreamweaver Tutorial Sangmok Han Feb 24, 2010.
Cascading Style Sheets
Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
Web Development & Design Foundations with XHTML Chapter 7 Key Concepts.
Principles of Web Design 5 th Edition Chapter Nine Site Navigation.
SM5312 week 11: CSS Menus & Navigation Bars1 An Introduction to Cascading Style Sheets CSS Menus and Navigation Bars Nick Foxall.
1 Web Developer & Design Foundations with XHTML Chapter 9 Key Concepts.
Advance CSS (Menu and Layout) Miftahul Huda. CSS Navigation MENU It's truly remarkable what can be achieved through CSS, especially with navigation menus.
Navigation Bars Level 2 Extended Certificate Unit B12 Doing Business Online.
Web Pages and Style Sheets Bert Wachsmuth. HTML versus XHTML XHTML is a stricter version of HTML: HTML + stricter rules = XHTML. XHTML Rule violations:
Dawn Pedersen Art Institute. What is Spry? Spry is Dreamweaver’s version of JavaScript libraries. Spry effects alter the look of a page element—or of.
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
TUTORIAL 4: CREATING PAGE LAYOUT WITH CSS Session 4.3.
Introducing Cascading Style Sheets  Cascading Style Sheet Basics  Creating Styles  Using Styles  Manipulating Styles  Text Formatting with CSS.
HTML Introduction HTML
INSTRUCTIONAL SUPPORT SERVICES (ISS) SHORT COURSE, FALL 2012 UMSL Introduction to Web Page Design.
Chapter 5 Web Graphics Styling Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
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.
Creating a Web Page HTML, FrontPage, Word, Composer.
Website design Feng Zhao College of Educatioin California State University, Northridge.
CIT 256 Organizing Large Websites: Divs, DW Templates Dr. Beryl Hoffman.
Advanced CSS - Page Layout. Advanced CSS  Compound Selectors:  Is a Dreamweaver term, not a CSS term.  Describes more advanced types of selectors such.
Macromedia Dreamweaver CS4 Tutorial. Example of the website1 folder & images folder inside Create a folder on your computer called website1 to hold all.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
Chapter 3 Dreamweaver: Part I The Web Warrior Guide to Web Design Technologies.
CA Professional Web Site Development Class 23 - CSS Positioning, Image Replacement & Print Styles.
Eat Your Words! Creating webpage Layout. CONTENT The Layout of a Webpage HEADER FOOTER Each of these sections represents a ‘div’ (or divider). By linking.
Using Styles and Style Sheets for Design
Links in HTML. Hyperlinks or links Millions of linked web pages make up the World Wide Web Used to connect a web page to another web page on the same.
Web Technologies Website Development Trade & Industrial Education
Tutorial 4 Creating Special Effects with CSS
CSS Sprites. What are sprites? In the early days of video games, memory for graphics was very low. So to make things load quickly and make graphics look.
CSW131 Steven Battilana 1 CSW 131 – Supplement 1 (X)HTML / CSS Not Covered or in Book Prepared by Prof. B. for use with Teach Yourself Visually Web Design.
Doman’s Sections Information in this presentation includes text and images from
Website Development with Dreamweaver
Chapter 5 Web Graphics Styling Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
CO1552 – Web Application Development Cascading Style Sheets.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
Adding Graphics to Web Pages. CSS does not have any properties specifically aimed at formatting images Use properties you have already learned, i.e.,
Macromedia Dreamweaver 8-- Illustrated Introductory 1 Macromedia Dreamweaver 8 Unit D Formatting Text and Using Cascading Style Sheets.
INTRODUCTION TO HTML5 Semantic Layout in HTML5.  The new semantic layout in HTML5 refers to a new class of elements that is designed to help you understand.
Link-Images. Understanding Links  Absolute Links: – URL is an absolute link—it’s the complete, unique address for a single page. Ex: – use absolute links.
HTML - Quiz #2 Attendance CODE:
More CSS.
Web Foundations TUESDAY, NOVEMBER 19, 2013 LECTURE 31: DREAMWEAVER: MODIFY MENU AND PROPERTY PANEL.
Introducing Cascading Style Sheets. Cascading Style Sheet Basics  Cascading Style Sheet Basics  Creating Styles  Using Styles  Manipulating Styles.
So far, we have looked at CSS selectors that correlate with HTML tags Now, we’ll see how you can define your own selectors using class and ID selectors.
Week 8 – Part 2 Page Layout Basics Key Concepts 1.
Principles of Web Design 6 th Edition Chapter 9 – Site Navigation.
Small group worksheet Lecture Code:
Web Design (8) Images (2). My Holiday Photos An exercise in adding and linking images. Create a new website folder calling it ‘My Holiday Photos’. In.
Tutorial 3 Adding and Formatting Text with CSS Styles.
Macromedia Dreamweaver 8 Revealed AND GRAPHICS WORKING WITH TEXT.
Week 2: Building a Simple Website IMC 320 Web Publishing Spring 2011.
Introduction to CSS Layout
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
CIT 256 CSS Intro & Dreamweaver Built-in Layouts Dr. Beryl Hoffman.
1 Creating Links Lesson 2. 2 In the center column type : Home | Order Now | Contact Us This is the navigation button which will link to the other pages.
PATHNAMES LINKS BACKGROUND.  Pathnames in hyperlinks & image tags  Absolute pathnames: for links to web addresses  Relative pathnames: for links to.
Positioning Objects with CSS and Tables
CSS IS A LANGUAGE DESIGNED TO TARGET HTML ELEMENTS AND NODES BY TYPE, CLASS, ID AND VALUE, AND CHANGE THEIR VALUES CSS – change how your HTML looks and.
Web Design (15) CSS Opacity, Link Colours & Background Images.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, we’ll cover:  Brief CSS review  Creating sections with the tag  Creating inline.
Creating Image Based Rollovers with CSS Mike Takahashi Office of Instructional Development.
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,
Cheat Sheet CSCI 100 JW Ryder
Cheat Sheet CSCI 100 JW Ryder
Session IV Chapter 15 - How Work with Fonts and Printing
Presentation transcript:

Dawn Pedersen Art Institute

What Are CSS Sprites? Back in the day, sprites were the images in games that swapped one little image for another in a specific place on the screen. The term has been appropriated by web designers to describe a CSS technique that is similar and very useful.

What Are CSS Sprites? Typically when we create graphical buttons, we make two images: One for the regular state of the button. One for the hover state. The images on the right are designed to repeat-x. With CSS Sprites these two images become one image. By using the background position properties in CSS, we can choose: which part of our image will be displayed for the inactive link which part will be displayed for the hover state

What Are CSS Sprites? The advantages are: there are fewer files to keep track of there are fewer http requests made of the server the file size for one larger image is smaller than the sum of a bunch of smaller images This may not seem like a big deal for two images, but it adds up for more. Let’s take a look at an example.

CSS Sprites Exercise 1. Download and unzip Take a look at buttons.psd with three buttons. The first is for a normal state The second is for a hover state The third we will use when we are on the destination page 3. We know from our guides that each button is 260 pixels wide and 60 pixels tall.

CSS Sprites Exercise 4. Take a look at buttons.jpg” The image has been flattened and cropped down to its final size (260px by 180px).

CSS Sprites Exercise 5. Open index.html in a browser and hover over each menu item.

CSS Sprites Exercise 6. Open index.html and styles.css in Dreamweaver in Code view. 7. Locate the CSS rules for #navigation li a and #navigation li a:hover. 8. Add the background declarations as shown on the right to each of these rules: background-image background-repeat background-position

CSS Sprites Exercise A little explanation: Both rules use the same buttons.jpg image. Because we are creating buttons, we don’t want the button background image to repeat. Because the tag is set to display: block and to a specific height and width, we do not see the rest of the background image. Then the position on the hover state sets the y position to -60px. This shows the second button in the image file on hover.

CSS Sprites Exercise With just a little bit of basic math you can display whichever image you need from the larger image. Let’s continue with setting our image for the destination page, as we did previously.

CSS Sprites Exercise 9. Add the following compound CSS rule to the bottom of the CSS file (notice the background-position): #page1 #page #sidebar #navigation.page1 a, #page2 #page #sidebar #navigation.page2 a, #page3 #page #sidebar #navigation.page3 a, #page4 #page #sidebar #navigation.page4 a, #page5 #page #sidebar #navigation.page5 a { color: #900; background-image: url(buttons.jpg); background-repeat: no-repeat; cursor: default; background-position: 0px -120px; }

CSS Sprites Exercise 10. In index.html, add an id="page1" attribute to the body tag. 11. Add the following class attributes within the menu: 12. In page 2.html: Add an id="page2" attribute to the body tag Replace the navigation ul element with that from index.html

CSS Sprites Exercise 13. Test the site in a browser. 14. Click on the page 1 and page 2 buttons to see the image rotation. If you open the completed folder, you will see all the pages are made. Open index.html in a browser and try the links out.

CSS Sprites Real-Life Example This particular use of the sprite is called a navigation matrix. Not only can you use the y axis to locate particular graphics, but you can use the x axis too. Check out the navigation in Apple’s website. Notice the roll over, active (when you press the button down), and destination page states.

CSS Sprites Real-Life Example Digging into the code reveals how they did this. Here is Apple’s navigation matrix. Top row for normal state Second row for hover state Third row for active state Fourth row for when you are on that particular page Each individual button is accessed one at a time with coordinates.

CSS Sprites Real-Life Example If you go to this page to see the CSS being used, it should be recognizable: Notice the position coordinates. They are what is pulling up the individual images.

CSS Sprites Resources There is a nice little tutorial on this particular navigation trick here: how-to-use-css-sprites/ how-to-use-css-sprites/ It’s a little long winded, but cool to watch anyway.

CSS Sprites Resources Sprites are not just used for navigation, but any sort of repeating icons and graphics used on your sites. Check out this tutorial: css/sprites/ All of those little green icons are in one graphic file. css/sprites/

CSS Sprites Resources Need help generating some sprite images and CSS? Try this site: