Creating Image Based Rollovers with CSS Mike Takahashi Office of Instructional Development.

Slides:



Advertisements
Similar presentations
Cascading Style Sheets
Advertisements

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.
Slide 1 CMPS 211 Internet Programming Spring 2008 Dynamic Effects with Styles Chapter 12 2/6/08.
Very quick intro HTML and CSS. Sample html A Web Title.
Part 5 Introduction to CSS. CSS Display - Block and Inline Elements A block element is an element that takes up the full width available, and has a line.
CSS Menus and Rollovers. Agenda foil Separating style from content 3 pages in one file Rollovers in CSS Horizontal drop-downs Vertical drop-downs.
Session 4: CSS Positioning Fall 2006 LIS Web Team.
SM5312 week 11: CSS Menus & Navigation Bars1 An Introduction to Cascading Style Sheets CSS Menus and Navigation Bars Nick Foxall.
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.
Diliev.com & pLOVEdiv.com  DIliev.com.
Class four: the box model and positioning. is an HTML tag which allows you to create an element out of inline text. It doesn’t mean anything! try it:
CS4370/6370 Web Development Cascading Style Sheets (CSS)
Web Design & Development Cascading Style Sheets (CSS)
Using CSS for Page Layout. Types of HTML Elements Block-Level Element –Creates blocks of content e.g. div, h1..h6, p, ul, ol, li, table, form –They start.
Interface Programming 1 Week 5. Interface Programming 1 CALENDAR.
MORE Cascading Style Sheets (The Positioning Model)
IMAGES Controlling size of images in CSS Aligning images in CSS Adding background images.
Page Layout & Mobile Web Using columns, grid systems, etc… to layout sites for desktops and mobile.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 4 Key Concepts 1 Copyright © Terry Felke-Morris.
Cascading Style Sheet Basics Pepper. Looking at the HTML See the surrounding tags See head, body, paragraph, header See the ending tags See the list.
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.
Image Use. Agenda Ordinary display of image: height, width, alt Rollovers Images as links (remove blue surround) Background images: stretch, tile, xonly/yonly.
CA Professional Web Site Development Class 23 - CSS Positioning, Image Replacement & Print Styles.
Web standards pragmatism Patrick H. Lauke / Web Developers Conference / 12 November 2008 FROM VALIDATION TO THE REAL WORLD.
Basics of Smarajit Dasgupta.
Tutorial 4 Creating Special Effects with CSS
Technologies for web publishing Ing. Václav Freylich Lecture 7.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 6 Key Concepts 1 Copyright © Terry Felke-Morris.
Images in HTML Images in the foreground –src loaded separately; relative to home directory –Width & height set aside space in page; do not use this to.
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 = Cascading Style Sheet CSS consists of rules to display, style and decorate HTML elements Why CSS ? – Separate decoration from HTML markup (Ex :,,…)
 Remember that HTML is just text  Need to point to pictures  Use the img tag  alt: › screen reader › REQUIRED for this class and to validate.
HTML - Quiz #2 Attendance CODE:
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.
Daveandal.net Cascading Style Sheets 101 “How I learnt to love CSS and found my inner designer”
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.
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 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.
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.
11/12/2015 Box Model Reed Crouch. 11/12/2015  HTML elements can be considered as boxes. In CSS, the term "box model" is used when referring to layout.
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.
Web Foundations MONDAY, OCTOBER 7, 2013 LECTURE 7: CSS LINK COLORS, INTERMEDIATE CSS.
Web Technologies Beginning Cascading Style Sheets (CSS) 1Copyright © Texas Education Agency, All rights reserved.
CONTROLLING Page layout
Chapter 6 Murach's JavaScript and jQuery, C6© 2012, Mike Murach & Associates, Inc.Slide 1.
Doncho Minkov Telerik School Academy schoolacademy.telerik.com Technical Trainer
Web Design (15) CSS Opacity, Link Colours & Background Images.
Cascading Style Sheet (CSS) SAMPLE IT133 Pengembangan Web.
PERSPECTIVES: TUTORIAL 4 CREATING PAGE LAYOUTS WITH CSS.
Simple Website Layout Tutorial Using HTML 5 and CSS 3 Ref: layout-tutorial-html-5-css-3/
ACT102 INTRODUCTION TO WEB DESIGN. Content Padding Border Margin.
INT222 – Internet Fundamentals Week 8: Using New HTML features 1.
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.
CS 120: Introduction to Web Programming Lecture 10: Extra Features and Website Design Part 1 Tarik Booker CS 120 California State University, Los Angeles.
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,
NAVIGATION USING HTML TO SET UP THE BASIC STRUCTURE OF A NAV BAR.
WebD Introduction to CSS By Manik Rastogi.
Chapter 7 Page Layout Basics Key Concepts
Cascading Style Sheets
Basics of Web Design Chapter 7 Page Layout Basics Key Concepts
Fixed Positioning.
Presentation transcript:

Creating Image Based Rollovers with CSS Mike Takahashi Office of Instructional Development

The “old” way Rollover effects were done using JavaScript and the “preload” command. Multiple separate images for each rollover had to be downloaded separately and took time.

The “better” way using CSS The Pixy Method  Works by using multiple image states in one single image and setting the CSS background-position property accordingly. This makes dynamic changes faster and requires no preload or JavaScript! We will be using this as a basis for our image-based rollovers.

Benefits From: Just one image is used. No preload is needed. State switching is as fast as possible (moving background position is much faster than replacing background image). Works in every CSS2 capable browser (IE5+, Firefox, Opera, Safari, etc.)

Create Your Image Create your image states as one image Here we have 2 states. The bottom is for the hover state and the top is for the normal state.

HTML and CSS Create your HTML code: Home Web Design Plone Print Photography Contact

HTML and CSS Creating a list will still allow for your page to work if CSS is disable.

CSS #nav { position: absolute; top: 55px; left: 290px; } #nav ul { position: relative; width: 480px; margin: 0; padding-left: 0; } #nav ul, #nav a:hover, #nav a.selected { background-image: url(nav.gif); background-repeat: no-repeat; height: 30px; } #nav li { position: absolute; list-style: none; } #nav li, #nav a { height: 30px; display: block; } /* Hides the HTML text and lets the rollover image show as the background image */ li span { display: none; }

CSS /* Width controls width of each text image. Top refers to position that is relative to nav.gif */ #navItem1, #navItem1 a { top: 0px; left: 0px; width: 44px; } #navItem1 a:hover, #navItem1 a.selected { background-position: 0px -28px; } #navItem2, #navItem2 a { top: 0px; left: 58px; width: 86px; } #navItem2 a:hover, #navItem2 a.selected { background-position: -58px -28px; } #navItem3, #navItem3 a { top: 0px; left: 152px; width: 77px; } #navItem3 a:hover, #navItem3 a.selected { background-position: -152px -28px; } #navItem4, #navItem4 a { top: 0px; left: 236px; width: 48px; } #navItem4 a:hover, #navItem4 a.selected { background-position: -236px -28px; } #navItem5, #navItem5 a { top: 0px; left: 295px; width: 105px; } #navItem5 a:hover, #navItem5 a.selected { background-position: -295px -28px; } #navItem6, #navItem6 a { top: 0px; left: 410px; width: 70px; } #navItem6 a:hover, #navItem6 a.selected { background-position: -410px -28px; }

Let’s see some examples Uses image based rollovers with CSS using two image states. ( Uses multiple images for two image states. ( home.gif) home.gif