|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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 ![]()
__________________
Alberta Custom Website Designs Websites for small businesses Support Forums and Freeware Tools Weekly Web News, PC News, HardWare News etc.. |
|
#3
|
||||
|
||||
|
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;
}
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. |
![]() |
| Viewing: Dev Shed Forums > Web Design > Web Design Help > Absolute Middle and similar positions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|