Welcome to Dream.In.Code
Become an Expert!

Join 149,999 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,315 people online right now. Registration is fast and FREE... Join Now!




Aligning to bottom-right

 
Reply to this topicStart new topic

Aligning to bottom-right

Esn
9 Dec, 2006 - 10:29 PM
Post #1

New D.I.C Head
*

Joined: 9 Dec, 2006
Posts: 2


My Contributions
Ok, so here's the thing... my concept is of a website with four equal-sized frames (top left, top right, bottom left, bottom right - consisting of two rows subdivided into two columns). There is no scrolling allowed in any of the frames, but they can be resized. Like so (this isn't really important, but I might as well show the code):
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>A Stroll Through a Landscape</title>
    <meta name="generator" content="BBEdit 8.2" />
</head>


<frameset rows="*,*" marginwidth="0" marginheight="0">
    <frameset cols="*,*" noresize scrolling="no" marginwidth="0" marginheight="0">
        <frame src="1.html" name="tl" scrolling="no" marginwidth="0" marginheight="0" />
        <frame src="2.html" name="tr" scrolling="no" marginwidth="0" marginheight="0" />
    </frameset>
    <frameset cols="*,*" noresize scrolling="no" marginwidth="0" marginheight="0">
        <frame src="3.html" name="bl" scrolling="no" marginwidth="0" marginheight="0" />
        <frame src="4.html" name="br" scrolling="no" marginwidth="0" marginheight="0" />
    </frameset>
</frameset>



<noframes>
Sorry.  No frames, no website. :(  You should get an internet browser that supports frames.  They're all the rage nowadays.
</noframes>

</html>


Each of the frames contains an image with a fixed resolution of 757x570.

Each of the four images is aligned to the point between the 4 frames, so: upper left image to bottom right corner of its frame, upper right image to bottom left corner of its frame, etc.

Aligning an image to the upper left corner of a frame (so that it stays in the upper left corner when the frame moves) is easy because that's its natural position. Aligning it to the upper right is also easy - I just have to add a simple
CODE
align="right"
code within the image tag.

But the bottom left and bottom right are very tricky, and I was wondering if someone here could help. I don't really care which language is used, I'd just like to see it done somehow.

The only way I found to align something to the bottom is explained here (example page). Unfortunately, there are two problems with this method - first of all, if the stuff that's placed at the bottom (be it text, as in that example, or an image, which is what I want) touches the top of the page, it stops being assigned to the bottom. Because my image is bigger than the initial size of the frame, it hits the top and the result is that it might as well be assigned to the top (to see what I mean, try making that example page really small and see how the text that was at the bottom sticks to the top of the page if the window gets narrow enough).

The second problem is that I can't figure out how to align it to the bottom AND to the right. My attempt at this (which produces no result) you can see below:

CODE
<?xml version="1.0" encoding="utf-8" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>
<style>
body, html {height: 100%;}
* html #footer {position:absolute;top: 99%;}
#footer[id] {position:fixed; display: table; height: 99%; top:0;}
* html #fcell {position: relative; top: -100%;}
#fcell[id] {display: table-cell; vertical-align: bottom;}
</style>
</head><body>
<div id="footer">
  <div id="fcell">
    <img src="01c.gif" width="757" height="570" align="right"/>
  </div>
</div>
</body>
</html>


Anyway, I really hope that someone can help with this complicated question. As I said, I'm open to using ANY language to get the result.

This post has been edited by Esn: 9 Dec, 2006 - 10:33 PM
User is offlineProfile CardPM
+Quote Post

Arbitrator
RE: Aligning To Bottom-right
11 Dec, 2006 - 04:09 AM
Post #2

D.I.C Regular
Group Icon

Joined: 26 Jan, 2005
Posts: 492



Thanked: 2 times
My Contributions
QUOTE(Esn @ 9 Dec, 2006 - 11:29 PM) *
Unfortunately, there are two problems with this method - first of all, if the stuff that's placed at the bottom (be it text, as in that example, or an image, which is what I want) touches the top of the page, it stops being assigned to the bottom. Because my image is bigger than the initial size of the frame, it hits the top and the result is that it might as well be assigned to the top (to see what I mean, try making that example page really small and see how the text that was at the bottom sticks to the top of the page if the window gets narrow enough).
I experimented with the example that you referred to and didn’t see what you referred to in the above quote. The positioned text remains at the bottom of the document in Firefox 2 and at the top of the window in Internet Explorer 7 (regardless of the viewport dimensions).

I wouldn’t use the code that you referred to at felgall.com anyway because it uses CSS to exploit both a browser flaw and lack of CSS support in Internet Explorer 6. The star‐HTML exploit doesn’t work in Internet Explorer 7 since that was fixed nor does the attribute selector exploit work in that browser because that browser now supports attribute selectors. The display: table and display: table-cell declarations are still not supported by Internet Explorer 7 however, so the example does not work in that browser.

With that said, what you need is absolute positioning (position: absolute) and the four positioning properties (top, right, bottom, left) to position the images relative to each document’s respective frame. Here’s a working example that, unlike the code you’ve shown, is also valid XHTML. It’s been tested in Firefox 2 and Internet Explorer 7.
User is offlineProfile CardPM
+Quote Post

Esn
RE: Aligning To Bottom-right
11 Dec, 2006 - 10:48 PM
Post #3

New D.I.C Head
*

Joined: 9 Dec, 2006
Posts: 2


My Contributions
Oh man, words cannot express my gratitude here. THANK YOU! smile.gif

I've been asking lots of people this in the past few days, and was giving up hope of finding an answer. I can't believe that someone would help a newcomer like me and create a whole example page - it was exactly what I was looking for, and I think I can figure out how it works now (I was confused for a little while because I downloaded it to my PC and forgot about the master.css file).

Thank you very much. There isn't much I can do in return, but... maybe I'll stay around on this forum for a while. You guys clearly have a good thing going here (by the way, I found this forum from a google ad).
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 08:27PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month