|
|
#1 |
|
The Master
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 44 ![]() ![]() |
Maybe Im just tired or maybe it cant be done.
Is there anyway to keep a div, or any other element for that matter, centered on a screen even if you scroll down? The question may seem a little crazy and why would I want to etc, but its something I desperatly need to do without using frames.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers. |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,424
Rep Power: 42 ![]() ![]() |
Assign the div to a class in CSS. Define the margins as auto for the left and right and that should do it.
-Mike
__________________
Mike-N-Tosh v3.1.10 Developer IndianaPC.org - A community website Sandbox v4.0.9, 4.1 Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds. Web Hosting | Web Design & Development | 68 Classifieds Customizations I am not a 68C employee, just a user and try to help out |
|
|
|
|
|
#3 |
|
The Master
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 44 ![]() ![]() |
nope I thought about that one, doesnt do it.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers. |
|
|
|
|
|
#4 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,424
Rep Power: 42 ![]() ![]() |
Hmmm.... That doesn't make any sense, because that is the equivalent of center for CSS. Is this div located within any other HTML elements or inline with any other CSS classes or id's? The latter has screwed me before many times, because the center will be based from the borders of the other CSS elements it is inline with.
__________________
Mike-N-Tosh v3.1.10 Developer IndianaPC.org - A community website Sandbox v4.0.9, 4.1 Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds. Web Hosting | Web Design & Development | 68 Classifieds Customizations I am not a 68C employee, just a user and try to help out |
|
|
|
|
|
#5 |
|
The Master
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 44 ![]() ![]() |
I need it absolute, so its not relative to anything else on the page.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers. |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,424
Rep Power: 42 ![]() ![]() |
I think that I misread your original post...
You want something centered in the WINDOW, both vertically and horizontally. Try this in your CSS sheet: (This would work with an image that is 100px by 100px) .centered { position: fixed; top: 50%; left: 50%; margin-top: -50px; // half the height of your object margin-left: -50px; // half the width of your object } Add a z-index if you want it to be behind or in front of other items. Hope that helps, -Mike P.S. I gotta see this when you're done!
__________________
Mike-N-Tosh v3.1.10 Developer IndianaPC.org - A community website Sandbox v4.0.9, 4.1 Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds. Web Hosting | Web Design & Development | 68 Classifieds Customizations I am not a 68C employee, just a user and try to help out |
|
|
|
|
|
#7 |
|
The Master
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 44 ![]() ![]() |
maldito position fixed!!! I knew this, its just been so long since I used it. Thanks mike, works a treat! You will see what this is for soon!
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers. |
|
|
|
|
|
#8 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,424
Rep Power: 42 ![]() ![]() |
No problem, Maffo. I'm glad that worked for you.
I just thought of something though and looked it up to refresh my memory. The fixed declaration doesn't work for IE6. You may need to change it to "absolute". Cheers, Mike
__________________
Mike-N-Tosh v3.1.10 Developer IndianaPC.org - A community website Sandbox v4.0.9, 4.1 Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds. Web Hosting | Web Design & Development | 68 Classifieds Customizations I am not a 68C employee, just a user and try to help out |
|
|
|
|
|
#9 |
|
The Master
Join Date: Mar 2006
Location: British in Argentina
Posts: 1,400
Rep Power: 44 ![]() ![]() |
yes I read up on that and there were a lot of workarounds for it, and then I thought, why should I bother! A: I dont have IE6 to check it against, B: I hate Internet Explorer & C: We should be programming for the future, not the past. If it doesnt look correct on an old browser, maybe it will be an incentive for the user to upgrade to a modern version, or even take a leap of faith away from microsoft.
__________________
**Bulk Upload System** has been upgraded. Works on all v4 versions with new functionality. Free upgrade for existing customers. |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| floating nav | thecarsales | v3.1 Modules & Modifications | 3 | 06-01-2006 09:31 AM |