Is there a prototype.js or script.aculo technique to easily center one div within another? SamC _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> Is there a prototype.js or script.aculo technique to easily center onediv within another? A few more words of explanation... - I''m familiar with centering DIVs using margin: 0 auto 0 auto; I need this DIV to be centered top to bottom, left to right... --- and it needs to work in IE 5.5, which is another level of difficulty. I''ve tried writing a JavaScript to get the height / width of both DIVs. It isn''t easy when either of the DIVs has height:auto; height will return "null". Sam _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Sam wrote:> > Is there a prototype.js or script.aculo technique to easily center > one div within another? > > A few more words of explanation... > > - I''m familiar with centering DIVs using margin: 0 auto 0 auto; I need > this DIV to be centered top to bottom, left to right... > > --- and it needs to work in IE 5.5, which is another level of difficulty.Even if prototye had one, according to http://wiki.script.aculo.us/scriptaculous/show/SupportedBrowsers, IE 5.5 isn''t supported. -- Michael Peters Developer Plus Three, LP
>Even if prototye had one, according to >http://wiki.script.aculo.us/scriptaculous/show/SupportedBrowsers, IE 5.5isn''t>supported.Sorry I brought up 5.5. I''d noticed prototype.js'' browser support earlier and gone ahead. So far, I''ve made a couple of 5.5 modifications to prototype.js. setStyle / getStyle had to try/capture error on cursor:pointer and switch to cursor:hand... and more. I don''t use all of prototype. What I do use is a benefit to development. Still, if there a good technique to center a couple of divs top/bottom, left/right, I''d be interested. Even if it is restricted to the browsers supported by prototype.js (which is quite a few...) Sam
http://www.andybudd.com/archives/2004/02/ css_crib_sheet_3_centering_a_div/index.php Thank you google :) first answer for "center a div in a div" On Jun 9, 2006, at 11:44 AM, Sam wrote:>> Even if prototye had one, according to >> http://wiki.script.aculo.us/scriptaculous/show/SupportedBrowsers, >> IE 5.5 > isn''t >> supported. > > Sorry I brought up 5.5. I''d noticed prototype.js'' browser support > earlier > and gone ahead. So far, I''ve made a couple of 5.5 modifications to > prototype.js. setStyle / getStyle had to try/capture error on > cursor:pointer and switch to cursor:hand... and more. I don''t use > all of > prototype. What I do use is a benefit to development. > > Still, if there a good technique to center a couple of divs top/ > bottom, > left/right, I''d be interested. Even if it is restricted to the > browsers > supported by prototype.js (which is quite a few...) > > Sam > > > > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Ben, that was kind of a glib answer. And an incorrect one -- that technique is only for horizontally centering. Sam is asking for vertical + horizontal. Try here for cross-browser viewport support: http://www.quirksmode.org/viewport/compatibility.html On 6/9/06, Ben Lisbakken <lisbakke-DG7SOAwx7rg@public.gmane.org> wrote:> > http://www.andybudd.com/archives/2004/02/ > css_crib_sheet_3_centering_a_div/index.php > > > Thank you google :) first answer for "center a div in a div" > > On Jun 9, 2006, at 11:44 AM, Sam wrote: > > >> Even if prototye had one, according to > >> http://wiki.script.aculo.us/scriptaculous/show/SupportedBrowsers, > >> IE 5.5 > > isn''t > >> supported. > > > > Sorry I brought up 5.5. I''d noticed prototype.js'' browser support > > earlier > > and gone ahead. So far, I''ve made a couple of 5.5 modifications to > > prototype.js. setStyle / getStyle had to try/capture error on > > cursor:pointer and switch to cursor:hand... and more. I don''t use > > all of > > prototype. What I do use is a benefit to development. > > > > Still, if there a good technique to center a couple of divs top/ > > bottom, > > left/right, I''d be interested. Even if it is restricted to the > > browsers > > supported by prototype.js (which is quite a few...) > > > > Sam > > > > > > > > > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I apologize - havent had my coffee this morning! On Jun 9, 2006, at 12:07 PM, Ed C. wrote:> Ben, that was kind of a glib answer. And an incorrect one -- that > technique is only for horizontally centering. Sam is asking for > vertical + horizontal. > > Try here for cross-browser viewport support: > > http://www.quirksmode.org/viewport/compatibility.html > > > On 6/9/06, Ben Lisbakken <lisbakke-DG7SOAwx7rg@public.gmane.org> wrote: > http://www.andybudd.com/archives/2004/02/ > css_crib_sheet_3_centering_a_div/index.php > > > Thank you google :) first answer for "center a div in a div" > > On Jun 9, 2006, at 11:44 AM, Sam wrote: > > >> Even if prototye had one, according to > >> http://wiki.script.aculo.us/scriptaculous/show/SupportedBrowsers, > >> IE 5.5 > > isn''t > >> supported. > > > > Sorry I brought up 5.5. I''d noticed prototype.js'' browser support > > earlier > > and gone ahead. So far, I''ve made a couple of 5.5 modifications to > > prototype.js. setStyle / getStyle had to try/capture error on > > cursor:pointer and switch to cursor:hand... and more. I don''t use > > all of > > prototype. What I do use is a benefit to development. > > > > Still, if there a good technique to center a couple of divs top/ > > bottom, > > left/right, I''d be interested. Even if it is restricted to the > > browsers > > supported by prototype.js (which is quite a few...) > > > > Sam > > > > > > > > > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
> Try here for cross-browser viewport support:<http://www.quirksmode.org/viewport/compatibility.html> > http://www.quirksmode.org/viewport/compatibility.html Quirksmode does it again. Still some work to get there, but this is a start. I was sure this problem must have been solved with JavaScript hundreds of times, but Google doesn''t pop up solutions. Sam _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs