Web Design Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignWeb Design Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 22nd, 2004, 02:07 AM
thecoverguy thecoverguy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 14 thecoverguy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Absolute Middle and similar positions

Greetings,

I used to be able to position an image, or anything basically, in a table cell that is in the "absolute middle" of a web page, i.e. centered horizontally and vertically, using Dreamweaver MX. But, for some weird reason, I cannot do it anymore using Dreamweaver MX 2004. No matter what I try, the image or contents of the cell or table are always at the top of the page, centered horizontally, yes, but not vertically.

I tried nesting a table within a table, and I tried using a percentage-based 3x3 table, but nothing works. I noticed that the "height" attribute of a table is deprecated now, thus, you should not give a table a "height" of 100%. Is that the reason? And if so, then what is another way to do this now? I mean putting an image or so in the absolute middle or center of a page? Better yet...

What I really want to do is to place an image in the vertical center of a page, yet a bit to the side, but within proportion to the page of the visitor. Meaning, I'd like the center of the image, for example, to always have 50% of the page over it and 50% below it, exactly; and I'd like it to have 33% of the page to its right side, for instance, and 66% to its left side, always, regardless to the visitor's resolution. Now how can I do this, especially using Dreamweaver MX 2004?

Thanks for anyone taking the time to help. I'll try to attach an image to demonstrate what I mean visually.
Attached Images
File Type: gif graphical demonstration.gif (2.6 KB, 365 views)

Reply With Quote
  #2  
Old July 8th, 2004, 03:49 AM
webguy's Avatar
webguy webguy is offline
Power User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Location: Canada
Posts: 180 webguy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 13 sec
Reputation Power: 5
Send a message via AIM to webguy Send a message via Yahoo to webguy
well, you''ll probably want to use a fixed width layout then...

This might work for you, although I would never use this method.. lol It might serve to give you some ideas though..

Code:
<html>
<style type="text/css">
<!-- 
html
{
 width:100%;
 height:100%;
 margin:0px;
 padding:0px;
} 

body
{
 width:100%;
 height:100%;
 margin:0px;
 padding:0px;
} 
-->
</style>
</head>
<body>

<div style="border:1px solid;width:750px;height:100%;position:relative;">
<img src="image.jpg" style="position:relative;top:40%;left:66%;margin-bottom:40%;"/>
</div>


</body>


You'll notice I didn't calculate the correct percentages relative to the center of the image. I'll let you do that part..
But basically, I positioned the image in a div that is the full size of the page. Using the top and left values to set the position to the left 66% and from the top 40% (an estimate because the top is measured from the top of the image and not the center of it, as such you can't really use 50% and expect to get the right results, this is where you'll have to get the right precentage respectively). Then I just made the div container get pushed down 40% from the bottom of the image by setting a bottom margin on the image of 40%. I didn't bother with the 33% from the right, but you could also do that using a right-margin of 33% or less because remember you need to take into account the width of the image into the percentage, just as you do with the height.

Well..there it is

If you want to use DreamW. and atable, all you need to do is create a single table with one table cell, no padding, no spacing, and set it's width to 100% height and width through css classes. Then use css classes for the image positioning. Although you might be better off with a div, as that is what I used and tested on.. it's up to you

Reply With Quote
  #3  
Old July 9th, 2004, 08:40 PM
kk5st's Avatar
kk5st kk5st is offline
Thanks Johnny Hart (BC) R.I.P.
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: May 2003
Location: Dallas
Posts: 4,541 kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level)kk5st User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 1 h 27 m 15 sec
Reputation Power: 597
See if this demo doesn't give you some ideas. The only way to proportionally locate an image (without a bunch of really ugly javascript) is as a background image,
Code:
body {
    background: url(some.jpg) 50% 30% no-repeat;
    }
or something similar.

cheers,

gary
__________________
There are those who manage to build a web site without knowing what they're doing; thereby proving to themselves they do, indeed, know what they're doing.

Ask a better question, get a better answer.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignWeb Design Help > Absolute Middle and similar positions


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway