Instead of using "in your face" skyscraper or double-wide banners, you can make a standard banner that expands to show more information. In this article, I provide you with easy code to create several different kinds of expanding banners.
Welcome to Bucaro TecHelp!

Welcome to Bucaro TecHelp!
Maintain Your Computer and Use it More Effectively
to Design a Web Site and Make Money on the Web

[About BTH]  [User Agreement]  [Privacy Policy]  [Site Map]  [Contact Form]  [Advertise on BTH]  [News Feed]

Google
Web
This Site

Easy Expanding Banner Code

The most common method for advertising on the Web is banners. But the standard banner may be too small to provide enough information. Instead of using "in your face" skyscraper or double-wide banners, you can make a standard banner that expands to show more information. In this article, I provide you with easy code to create several different kinds of expanding banners.

The code consists of four parts:

1. An html <span> element on your webpage
2. One or two optional graphics images
3. One or two Cascading Style Sheets (CSS) classes
4. One or two Java Script functions

Don't be scared off by the (CSS) classes or Java Script functions, I promise you, this is very easy to do. Lets do the most difficult example first. This first example does not use a graphic image for the banner, it relies entirely on CSS to create the banner.

The banner is defined as a <span> in the <body> section of your webpage, the html is shown below.

<span class="expandable" id="banner">Move mouse pointer over banner</span>

Note that the span has a class attribute and an id attribute defined. The text "Move mouse pointer over banner" is the text that will appear on your banner. Replace this text with your advertising message.

The code for the CSS class "expandable" is shown below. Paste this code in the <head> section of your webpage.

<style type="text/css">
.expandable
{
   position: absolute;
   left: 0;
   top: 0;
   width: 468;
   height: 60;
   border-style: solid;
   border-width: 4;
   border-color: blue;
   margin: 10px;
   padding: 5px;
   background-color: yellow;
   background-image: url("background.gif");
   color: red;
   font-family: Arial;
   font-weight: bold;
   font-size: 20pt;
   font-style: italic;
   z-index:2;
   visibility: visible;
}
</style>

The purpose of this article is give you some quick easy working code, not to bog you down with a long-winded explanation of CSS. So I will point out only a few important facts about the CSS code. The lines left: 0; top: 0; width: 468; and height: 60; define the location and size of the banner. Note that the standard banner size is 468 x 60 pixels.

The code defines a background-color property and a background-image property. Obviously it is not useful to define both of these properties together. Delete the line for the one you don't want to use.

Most of the other "property: value;" pairs defined in the class are self explanatory and you can experiment with them. Except for the color property, which actually applies to the text color.

Web Design Sections

RSS Feed RSS Feed

Easy Java Script Code
Easy Java Script Windows
Easy Rollovers
Easy Picture Transition Effects
Easy Moving Popup Code
Easy Slide Show Code
Easy Slide Show Code With Linked Slides
Slide Show with Different Size Images
Easy Picture Zoom Code
Easy Picture Panning Code
Easy Java Script Animation
Easy JavaScript Picture Selector Code
Easy Animated Banners with Java Script
Easy Java Script Form Validation
Easy Drag n Drop Code
Easy Graph Generating Code
Easy Code to Sort a Table by Column
Easy Fading Text Banner Code
Easy Expanding Banner Code
Calendars for Your Website
Date Picker For Your Web Site
Calculators For Your Web Site
Loan Payment Calculator
Length Units Converter
Body Mass Index
Fahrenheit to Celsius Converter
Decimal to Hexidecimal Converter
Easy Code for Screen Tape Adding Machine
Code for Java Script Circle⁄Sphere Calculator
Round a Float to 4 Digits to the Right of the Decimal Point
Make Your Own Graphical Digital Clock
Let Your Web site Visitors Set Font Size
How to Disable the Browser Back Button
Add More Bang to Your Content With Keyword Popup Menus
Put a Music Off Switch on Your Webpage
Java Script Random Password Generator
Password Protection Using Java Script
Replace Drop-down with Drag-and-drop
Submit Forms Without CGI
Code for a Less annoying Popup Window
Using the Java Script Array Object
Using the Java Script Date Object
Java Script Message Boxes
How to Shuffle the Deck With Java Script
Web Site Menus : Which Section Am I In?
How Far Did the User Scroll?
Where Did the User Click?
Four Ways to Use Java Script Event Handlers
Create Your Own Database Using Only Notepad : CDV

[Site User Agreement]  [Advertise on This site]  [Search This Site]  [Contact Form]
Copyright©2001-2007 Bucaro TecHelp P.O.Box 18952 Fountain Hills, AZ 85269