View Full Version : Centering div with form in it in web page
03-29-2009, 04:07 AM
Hi all, I'm sort of new to CSS and I've been working on the same thing for like 3 hrs. I have a page I created in fireworks and exported to dreamweaver. Everything is fine when I apply my CSS which centers and adds a background. The problem is I have a form that needs to go into the center of the page. I created the form in DW. I draw a div on the page and paste the code in at<div id="apDiv1">. The form is now in the page. The problem is that I cant seem to anchor the form there. I preview it in the browser and when I adjust the screen size the form moves but the background stays the same even when I apply CSS to the div containing the form.
03-29-2009, 06:33 AM
It sounds like DW is steering you toward using absolute positioning.
The quick fix might be to make the contianing div position:relative; That way the positioned div will base it's position off the top left of it's container instead of the top left of the viewport.
03-29-2009, 03:35 PM
Thank you, looks like its working by simply changing it to relative
03-29-2009, 07:21 PM
After you learn a bit more you can start getting away from absolute positioning and start using floats and margins to build your webpages.
Pitfalls of Absolute Positioning (http://www.tyssendesign.com.au/articles/css/absolute-positioning-pitfalls/)
Float Tutorial (http://www.w3schools.com/css/pr_class_float.asp)
It's really a shame that new coders, not having a clue where to start, are steered by DreamWeaver toward using absolute positioning and "layers." AP has it's uses but not that often.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.