CSS Techniques: Scrolling gradient over a fixed background

Similar documents
CREATING A NEWSLETTER IN ADOBE DREAMWEAVER CS5 (step-by-step directions)

Web Design Basics. Cindy Royal, Ph.D. Associate Professor Texas State University

Using Style Sheets for Consistency

HTML CSS Basic Structure. HTML Structure [Source Code] CSS Structure [Cascading Styles] DIV or ID Tags and Classes. The BOX MODEL

Using an external style sheet with Dreamweaver (CS6)

Introduction to Adobe Dreamweaver CC

Dreamweaver CS4 Day 2 Creating a Website using Div Tags, CSS, and Templates

How to create pop-up menus

CSS - Cascading Style Sheets

How to Add a Transparent Flash FLV movie to your Web Page Tutorial by R. Berdan Oct

CREATING HORIZONTAL NAVIGATION BAR USING ADOBE DREAMWEAVER CS5

Web Design with CSS and CSS3. Dr. Jan Stelovsky

Designing HTML s for Use in the Advanced Editor

Creating and Using Links and Bookmarks in PDF Documents

Fireworks 3 Animation and Rollovers

Adobe Dreamweaver CC 14 Tutorial

Fireworks CS4 Tutorial Part 1: Intro

Using Adobe Dreamweaver CS4 (10.0)

Style & Layout in the web: CSS and Bootstrap

Responsive Web Design for Teachers. Exercise: Building a Responsive Page with the Fluid Grid Layout Feature

Creating Personal Web Sites Using SharePoint Designer 2007

IAS Web Development using Dreamweaver CS4

Ingeniux 8 CMS Web Management System ICIT Technology Training and Advancement (training@uww.edu)

PASTPERFECT-ONLINE DESIGN GUIDE

Web Development CSE2WD Final Examination June (a) Which organisation is primarily responsible for HTML, CSS and DOM standards?

LaGuardia Community College Thomson Ave, Long Island City, New York Created by ISMD s Dept. Training Team. Overview

Web Design. Links and Navigation

Joomla! 2.5.x Training Manual

SiteBuilder 2.1 Manual

Create Webpages using HTML and CSS

Instructions for Creating a Poster for Arts and Humanities Research Day Using PowerPoint

Madison Area Technical College. MATC Web Style Guide

Basic Website Maintenance Tutorial*

File types There are certain image file types that can be used in a web page. They are:

Introduction to Web Design Curriculum Sample

Course Project Lab 3 - Creating a Logo (Illustrator)

PE Content and Methods Create a Website Portfolio using MS Word

Virtual Exhibit 5.0 requires that you have PastPerfect version 5.0 or higher with the MultiMedia and Virtual Exhibit Upgrades.

Introduction to Drupal

Building a Horizontal Menu in Dreamweaver CS3 Using Spry R. Berdan

HTML5 and CSS3 Part 1: Using HTML and CSS to Create a Website Layout

Embedding a Data View dynamic report into an existing web-page

PowerPoint 2007 Basics Website:

WP Popup Magic User Guide

Creating Web Pages with Dreamweaver CS 6 and CSS

Graphic Design Basics Tutorial

Dashboard Skin Tutorial. For ETS2 HTML5 Mobile Dashboard v3.0.2

WP Popup Magic User Guide

Building a Personal Website (Adapted from the Building a Town Website Student Guide 2003 Macromedia, Inc.)

Omnitapps Cloud Request Version 1.0 Manual

Digital Signage with Apps

WHITEPAPER. Skinning Guide. Let s chat Velaro info@velaro.com by Velaro

TUTORIAL 4 Building a Navigation Bar with Fireworks

Microsoft Expression Web

Frames. In this chapter

Microsoft Expression Web Quickstart Guide

Website Builder Manual

How To Change Your Site On Drupal Cloud On A Pcode On A Microsoft Powerstone On A Macbook Or Ipad (For Free) On A Freebie (For A Free Download) On An Ipad Or Ipa (For

Table of Contents. I. Banner Design Studio Overview II. Banner Creation Methods III. User Interface... 8

Creating Hyperlinks & Buttons InDesign CS6

Dreamweaver. Introduction to Editing Web Pages

Microsoft Picture Manager. Picture Manager

Website Login Integration

Dreamweaver Tutorials Creating a Web Contact Form

Flash MX Image Animation

NDSU Technology Learning & Media Center

WebFOCUS BI Portal: S.I.M.P.L.E. as can be

Joomla! template JSN Mico Customization Manual

PowerPoint: Graphics and SmartArt

Fortis Theme. User Guide. v Magento theme by Infortis. Copyright 2012 Infortis

WEB DESIGN COURSE CONTENT

ITP 101 Project 3 - Dreamweaver

Lession: 2 Animation Tool: Synfig Card or Page based Icon and Event based Time based Pencil: Synfig Studio: Getting Started: Toolbox Canvas Panels

Getting Started with KompoZer

ACADEMIC TECHNOLOGY SUPPORT

How to Customize Support Portals

Website Planning Checklist

How to Properly Compose HTML Code : 1

Creating mobile layout designs in Adobe Muse

Create A Collage Of Warped Photos

Creating a Web Site with Publisher 2010

Introduction to Macromedia Dreamweaver MX

KOMPOZER Web Design Software

About the HealthStream Learning Center

Photoshop- Image Editing

Create Your own Company s Design Theme

Copyright 2006 TechSmith Corporation. All Rights Reserved.

Transcription:

This is a little hard to describe, so view the example and be sure to scroll to the bottom of the page. The background is a gradient that fades into a simple graphic. As you scroll down the page, the graphic stays in the same fixed position at the bottom of your browser window, but the gradient reverses. As you approach the end of the page, the graphic changes colors, or reveals objects that were previously unseen. I canʼt remember where I saw an explanation of the technique, but if I do I will provide credit. I thought it had many possibilities beyond the simple example that was shown, but with deadlines looming I had to store it away for another day. Finally, today I had some time to kill and I decided to see if I could reproduce the effect. There are 3 images: 2 gradient blends and 1 graphic. The graphic consists of (at least) an area that is visible when viewed in the lightest color of the blend and another area that is the same color, and therefore invisible, in the lightest blend color. This area becomes visible in the darker blend colors. Iʼve provided the files for the images, including the layered Photoshop file, the basic HTML file and the CSS file which you can download. The instructions below are detailed enough for Photoshop newbies can follow along. The coding is reasonably simple, though some knowledge of HTML and CSS is assumed and FTP access to a server is needed. If needed, you can download these instructions as a PDF. You will need to set up a folder for this project. In it, create another folder named images. In Photoshop, start with the blends: a. In Photoshop, create a new document that is 10 px wide and 500 px tall. b. Select a foreground color and a background color that will be the endpoints of the gradient. While in the Color Picker, remember the hexidecimal codes for the lighter color so that it can be referenced in the CSS. In the example, I used #333333 for the foreground color and #d6d6d6 for the background color. Cascadia Graphics & Publishing, 04 Nov 2009" 1

d. Create a gradient blend starting with the darkest color at the top. If you are unfamiliar with the process of creating gradients, follow the sequence in this illustration. 1. Select a foreground color and a background color that will be the endpoints of the gradient. 2. Choose the Gradient tool. 3. The gradient option should default to your selected foreground and background colors. If not, click the dropdown arrow and select the correct gradient from the choices. 4. Click at the top of your image and drag to the bottom. When you release, the gradient will be drawn. Repeat if you need to adjust. therefore important. e. Save this gradient as a medium quality JPG using Save for Web & Devices... (under the File menu). I used the filename bkg_33tod6.jpg with shorthand for the hex colors as a reminder and saved the file to the images folder. f. Flip the image vertically (Image > Image Rotation > Flip Canvas Vertical). g. Save the reversed gradient as above. I used bkg_d6to33.jpg. Now create the graphic: h. For an effective, simple example, create a new image that is about 200 px tall by 300 px wide with the Background Contents set to Transparent (refer to the first illustration, above). The exact dimensions would be influenced by the width of the main content area. The narrower the area, the graphic can be more complex, though it will repeat horizontally across the bottom window. A seamless transition is i. Use the same foreground and background colors that you selected for the gradient. Select All (Select > Select All) and fill with the background color (Edit > Fill and Use: Foreground Color). j. Create a new layer (Layer > New > Layer ) Select All and fill with the foreground color. Cascadia Graphics & Publishing, 04 Nov 2009" 2

k. Create another new layer and place it at the top of the layer stack. Make sure the layer with darkest color is not visible by clicking on the visibility icon ( ) in the layers panel or by placing it at the bottom of the layer stack. Paint or draw a graphic image using the foreground drawing color. This color will be invisible when at the bottom of the page. Colors that are lighter will still be faintly visible. In this example, only 2 colors were used. The reflection of the trees in the water will be visible at the bottom of the page while the trees will fade away. l. Create another new layer and place it on top of the layer stack. Make the layer with the darkest color visible and the other 2 layers invisible. m. Exchange the foreground and background colors (press the ʻxʼ key). n. Draw or paint the object that you want to be visible at the bottom of the page. The trick is to avoid the dark colored areas in the layer below. To do this, CMD-click (or CNTL-click) on the Layer Thumbnail layer below to cause the filled area to be selected. Cascadia Graphics & Publishing, 04 Nov 2009" 3

Then, click on the layer above to make it the active layer and begin to draw or paint using the lighter drawing color. This area will be invisible until the bottom of the scroll is reached. In the example, I drew stars in the sky, selected the sky region and copied and pasted it (to a new layer), flipped the layer vertically (Edit > Transform > Flip Vertical) and moved it into position as a reflection of the stars in the water. o. When the graphic is done, make the dark fill layer (at the bottom of the layer stack) invisible and Save for Web & Devices. Since the background needs to be transparent, choose the present for PNG-24. In this example, I named the file river_frieze.png. Now you are ready to start coding a. In your favorite text editor create a new file and copy the following basic HTML structure and paste it into your file (or in Dreamweaver, open a new HTML file): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> " <meta http-equiv="content-type" content="text/html; charset=utf-8" /> " <title>untitled Document</title> </head> <body> </body> </html> Save this file as test.html in your project folder. Cascadia Graphics & Publishing, 04 Nov 2009" 4

b. Create another new blank file for the CSS (or open a new CSS file in Dreamweaver) and save this file as style.css in your project folder. c. To link the CSS file to the HTML file, add the following to the <head> section of index.html: <link href="style.css" rel="stylesheet" type="text/css" /> d. The <body> will be styled to hold the background color. Also, there are 4 structural components, or DIVs to this page in the following heirarchy: A container for the background gradient at the bottom of the page A container for the graphic image A container for the main content of your page The main content of your page Inside the <body> set up the 4 DIVs: <div id="background"> " " <div id="graphic"> " " " <div id="maincontainer"> " " " " <div id="maincontent"> " " " " </div> " " " </div> " " </div> " </div> Thatʼs all that is needed for the HTML side. The rest is handled by CSS. Save index.html. Open style.css e. For this example, the maincontainer ID, or the content of your page is 640 px wide (width: 640px; ) f. It has a white background (background: #FFFFFF;) g. It is centered in the window (margin: 0 auto; ) h. It also has a solid, black border around all 4 sides (border: 1px solid #000000; ) i. And, because we want to see the effect after scrolling through a long page of content, the height is 2000 px (min-height: 2000px; ) j. The CSS for this ID is: #maincontainer { " width: 640px; " background: #FFFFFF; Cascadia Graphics & Publishing, 04 Nov 2009" 5

" margin: 0 auto; " border: 1px solid #000000; " min-height: 2000px; } If you upload your files and test in your browser, the page should look like this: A white rectangular area centered in the window. The scroll bar indicates that this is a long page. k.next, style the body with the lightest color as the background (background: #d6d6d6; ) l. The dark-to-light gradient (bkg_33tod6.jpg) will also appear in the background at the top of the window so add the url (background: #d6d6d6 url(bkg_33tod6.jpg); ) m. The gradient will repeat horizontally across the width of the window (background: #d6d6d6 url(bkg_33tod6.jpg) repeat-x; ) n. Since we want the background to extend to the edges of the window, the margins will be 0 px on all sides (margin: 0; ) o. The full CSS for the body: body { " background: #d6d6d6 url(bkg_33tod6.jpg) repeat-x; Cascadia Graphics & Publishing, 04 Nov 2009" 6

" margin: 0; } Now if you upload and refresh, the window should look like this: As you scroll down, the gradient disappears, leaving the solid background color. p. The background ID will only hold the light-to-dark gradient that will be anchored to the bottom and extend across the window: #background { " background: url(bkg_d6to33.jpg) repeat-x left bottom; } Now if you upload and refresh and scroll to the bottom of the page, the window should look like this: Cascadia Graphics & Publishing, 04 Nov 2009" 7

q. Finally, add the.png image as a background image to the graphic ID and repeat image across the window (background: url(river_frieze.png) repeat-x; ) r. To hold the graphic in position at the bottom of the window, the backgroundattachment style must be fixed and the background-position (Y) is set to bottom. s. There must be a slight offset to the left (for some reason), so the background-position (X) is set to -10 px. t. The styling for this ID is: #graphic { " background: url(river_frieze.png) repeat-x fixed -10px bottom; } If you upload and refresh, the graphic should appear at the bottom of the window: Cascadia Graphics & Publishing, 04 Nov 2009" 8

And as you scroll to the bottom of the page, the reflection in the water disappears and the stars come out. Cascadia Graphics & Publishing, 04 Nov 2009" 9