Forums
This topic is locked
Centering a Selected Element
Posted 22 Oct 2006 04:52:47
1
has voted
22 Oct 2006 04:52:47 deca decapyre posted:
I've Managed to make an extension to create a new style on the current document, then create a ID called #CenterContainer:#CenterContainer {
position:absolute;
overflow:hidden;
top:50%;
left:50%;
width:348px; //calculates the height of selected element
height:104px; //calculates the width of selected element
margin-top:-52px; //calculates -half the height of selected element
margin-left:-174px; //calculates -half the width of selected element
}
if the element was placed in <div id="CenterContainer"></div> it would in turn be centered.
I need some help with the dreamweaver API side, trying to wrap <div id="CenterContainer"></div> around a selected element so it will b centered with 1 click.
So basically how do you wrap a div around a selected element, without the InsertDiv command that is already available, this is slighty different, because it creates a style aswell.
all help is appreicated!!