Shape Summary
Most of use are not gifted artists, but that doesn't stop us from wanting our sites
to look as interesting as possible. To make it easy on us, VML proves 8 different
pre-defined shapes that can easily be added to you web page.
I have a separate page for each of the eight, but I thought you might like to see all of
them (and the code the makes them) at one time. Plus, I've provided a summary of all
VML element and attributes (a reference for you as you get more into VML).
Return to top of document
Before You Start
Before you can use VML within MSIE, there are two lines of code which
must be added to your web page. First, the normal <HTML> tag should be
replaced with the following:
<html xmlns:v="urn:schemas-microsoft-com:vml">
Also, the following line must be placed in the <HEAD> section of the web page:
<style> v\:* { behavior: url(#default#VML); }</style >
These two tags enable MSIE to recognize and render VML tags, such as the simple
rectangle VML tags we've seen so far. With these two lines entered, the core
HTML code will look like:
<html xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<style> v\:* { behavior: url(#default#VML); }</style >
</head>
<body>
</body>
</html>
Return to top of document
Pre-Defined Shapes
VML supports a total of eight (8) pre-defined shapes. Here's a sample of each, along
with the VML tag required to create the shape. Remember that if you want to create
an entirely new shape, use the shape element.
Rectangle:
<v:rect style="width:100;height:100" fillcolor="red" strokecolor="blue"/>
Rectangle (rounded):
<v:roundrect style="width:100;height:100" arcsize="0.3" fillcolor="blue" _
strokecolor="red"/>
Line:
<v:line style="width:100;height:100" from="0,0" to="100,100" _
strokecolor="red" strokeweight="4pt"/>
Polyline:
<v:polyline style="width:100;height:100" points="0,60,50,90,60,10,100,100" _
strokecolor="blue" strokeweight="1pt"/>
Curve:
<v:curve style="width:100;height:100" from="0,0" control1="30,90" _
control2="80,10" to="100,0" strokecolor="red" strokeweight="3pt"/>
Arc:
<v:arc style="width:100;height:100" startangle="0" endangle="120" _
strokecolor="blue" strokeweight="2pt"/>
Oval (circle):
<v:oval style="width:100;height:100" fillcolor="red" strokecolor="blue" _
strokeweight="1pt"/>
Oval:
<v:oval style="width:100;height:50" fillcolor="blue" strokecolor="red" _
strokeweight="3pt"/>
Return to top of document
Element & Attribute Summary
-- this section is in revision: 30 May 2004 --
Yes, I know, we haven't discussed everything in this table yet, but I wanted to put it
right near the top of this page so you'll see it and can refer to it as you try to put
together the various pieces of VML.
Feel free to skip this section and return to it when you feel the need to get a summary
view of how the elements and attributes fit together.
First, here's a listing of all the elements supported by VML.
The supported attributes of each element are listed in the next table. The core elements define
various shapes, either custom or pre-defined. Sub-elements are designed to be used within a core
element to modify its characteristics. The Other element category is not so easily described in
a single statement. Take a look at the definition of each element in this category to understand
its function.
| VML Core Elements
|
|---|
| group | combines multiple shapes into a single unit that can be modified all at once
| | shape | allows definition of a custom shape
| | shapetype | same as shape, except acts as a prototype that can be referenced with a shape element
| | arc | portion of a circle
| | curve | arbitrary line defined by the contents of a path attribute
| | image |
| | line | straight line connecting to xy coordinates
| | oval | oval shape
| | polyline | line consisting of multiple staight line segments
| | rect | rectangle shape
| | roundrect | recetangle shape with user-definable rounded corners
| | VML Sub-elements
|
|---|
| path | defines shape outline. used by shape and polyline elements
| | formulas | define formulas that can vary the path of a shape, its inscribed text rectangles, and connection sites. Formula values change as the adj values change on the shape. Formulas can reference other formulas defined earlier in the same formulas element
| | handles | define user interface elements which can vary the adj values on the shape, thereby changing the value of formulas and the rendering of a path based on formulas and adj values.
| | fill | determines a variety of characteristics of a shape (except arc, line, and polyline)
| | stroke | defines visual characteristics of the outline of a shape
| | shadow | creates a shadow for any shape
| | textbox | controls a variety of visual characteristics for words inside a shape
| | textpath | determines where the text in a shape is placed
| | imagedata | identifies the bitmap to be included in a shape and how to apply it
| | VML Elements (other)
|
|---|
| f | defines a single value as the result of the evaluation of an expression
| | h | defines which pair of adjust values store the position of the handle and how the handle position can vary as the handle is adjusted
| | callout | -
| | extrusion | -
| | locks | -
| | skew | -
| | background | describes the fill of the background of a page using vector graphics fills
|
The supported attributes of each VML element are listed in the next table.
| Elements and Attributes
|
|---|
| Core Elements | Sub-elements | Other Elements
|
|---|
group shape shapetype arc curve image line oval polyline rect roundrect
| path formulas handles fill stroke shadow textbox textpath imagedata
| f h callout extrusion locks skew background
|
|---|
| VML Core Attributes
|
|---|
| VML Unique Attributes
|
|---|
| CSS Attributes (part of Style)
|
|---|
The shape element is the most complex of all elements. The list of attributes given for
it in the table above were only some of the most commonly used attributes. The following
tables provides the complete list of attributes for a shape element.
| Shape Element Attributes
|
|---|
| Adj | ConnectorType | HRPct
| | AllowInCell | CoordOrig | HRStd
| | AllowOverlap | CoordSize | HRWidth
| | Alt | DoubleClickNotify | ID
| | BorderBottomColor | FillColor | Left
| | BorderLeftColor | Filled | Margin-Bottom
| | BorderRightColor | Flip | Margin-Left
| | BorderTopColor | ForceDash | Margin-Right
| | Bullet | Height | Margin-Top
| | Button | HR | MSO-Position-Horizontal
| | BWMode | HRAlign | MSO-Position-Horizontal-Relative
| | BWNormal | HRef | MSO-Position-Vertical
| | BWPure | HRHeight | MSO-Position-Vertical-Relative
| | Class | HRNoShade | MSO-Wrap-Distance-Bottom
| | MSO-Wrap-Distance-Left | Rotation | UserHidden
| | MSO-Wrap-Distance-Right | RuleInitiator | Visibility
| | MSO-Wrap-Distance-Top | RuleProxy | Width
| | MSO-Wrap-Edited | Spt | WrapCoords
| | MSO-Wrap-Mode | StrokeColor | Z-Index
| | OLEIcon | Stroked |  
| | OnEd | StrokeWeight |  
| | OnMouseOver | TableLimits |  
| | Path | TableProperties |  
| | Position | Target |  
| | PreferRelative | Title |  
| | Print | Top |  
| | ReGroupID | Type |  
| | RelativePosition | UserDrawn |  
|
A definition of all VML attributes is given in the following table.
|