How to Use a Starburst on Your Web Page
By Stephen Bucaro
A "starburst" is a Web graphic that depicts a star or an explosion. Within
the starbust is some exclamatory advertising text like "Free!", "New!", or "Sale".
The starburst draws the viewers attention to the exclamatory advertising text.
A starburst can be entirely graphic, that is, the starbust and the text are
all in one graphic image. An entirely graphic statburst has the advantage
that it's easy to create, and you have complete control of the appearance of
the text. It has the disadvantage that, when you need to change the text, you
need to edit the graphic in an image editing program.
In this article, I show you how to use a starburst graphic with text that you
type in and it appears within the starbust. This has the advantage that you
can change the text without editing the graphic. This would be a great advantage
if you need to change the advertising text frequently, for example if a sale
price changes frequently.
Our method to accomplish this task is to use the starburst graphic as the
background image for a DIV element. The text will be placed within another DIV
element that is nested inside the DIV with the starburst background. We'll
use style to define the location and appearance of the text.
Shown below is the DIV with a starburst graphic configured as its background.
<div style="width:129px; height:95px;
background-image:url('starburst035.gif');
background-repeat:no-repeat;
background-position: 0px 0px;">
</div>
In the DIVs style attribute, the width and height
properties are set to the same dimensions as the Width and height
of the starburst graphic.
Note - in this article, I’m placing the style code inline. Normally
style code is placed in an external file which is linked to the webpage. If
you're going to use only one instance of a starbust on your web site, then
inline style code is best. If you're going to use multiple instances of a
starbust, then external style code is best.
Shown below is the parent DIV with the child DIV, containing the text, nested inside.
<div style="width:129; height:95;
background-image:url('starburst035.gif');
background-repeat:no-repeat;
background-position: 0px 0px;">
<div style="position:relative;
left:40px; top:24px; width:80px;
font-family:'Comic Sans MS';
color:red;
font-size:12px;
font-weight:bold;
font-style:italic;
line-height:10px;">FREE<br /> BONUS WITH ORDER!
</div>
</div>
Properly setting the style properties of the DIV containing the text requires
careful attention and experimentation. You must set the font-size and
line-height properties such that the text is not too large to fit within
the starbust. Then you need to set the left and top properties to
position the text correctly within the starbust.
Note that the DIVs position property is set to relative. This
means that the left and top values are the distances from the DIVs
upper-left corner to the upper-left corner of the parent DIV.
|