Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 02-03-2005, 16:00   #1 (permalink)
Justin Koivisto
Civilians

 
Default CSS positioning relative to an element

I am trying to get something to work and am having problems with the
CSS portion of it. Before I forget, the URL is:
http://www.minnesotanortheast.com/new-index.php

Basically, it's to function just like an image map, but using CSS
positioning instead of the MAP and AREA html tags...

I have a JPG of a map with the background that I want to show. On top
of the map, I need to place some label images on it. Because the labels
that are displayed will be chosen by means of a database query, I
cannot simply create the image maps to do this for each combination
(right now, that'd be 144 of them, and they plan to add more later).
Therefore, to do this, I have my php script spit out the necessary HTML
code which would look like this (simplified):

<div id="nemnmap">
<img src="/images/nemn-map.jpg">
<div><img src="cranelake.png"></div>
<div><img src="duluth.png"></div>
<div><img src="ely.png"></div>
</div>

Each div inside the nemnmap element has styles defined like so:
position:absolute; top:?px; left:?px; width:?px; height:?px;

Where "?" is a number (also pulled from a database).

Here's the problem...

I want the nemnmap to have text wrap around it like this:

alskdf alksdjf aiopsdj faasd asdlkf peawirm fa[perijaprgji
alskdf alksdjf aiopsdj faasd asdlkf peawirm fa[perijaprgji
alskdf alksdjf aiopsdj +-------------------------------+
asdfj apsijdg pijapirfg | |
asdfgh4i8yd gwipj58j | This is the map |
asdfj apsijdg pijapirfg | |
+-------------------------------+

So, I defined a margin and to float:right; However, I can't seem to get
the map *and* it's elements in the correct position (except in
Moz/Firefox/MSIE - and the float doesn't even work for them
correctly!). If I use position:absolute, the elements are positioned
correctly, but the map covers the text. Using static or relative allow
the map to appear in the correct position, but the child elements are
absolutely positioned in relation to the body instead of the nemnmap
div element.

Can I even do this so that it works with Mozilla, Firefox, Netscape,
MSIE, Opera and Safari for Mac/PC?

TIA for any help/insight you can offer.

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 02-03-2005, 16:00   #2 (permalink)
GreyWyvern
Civilians

 
Default Re: CSS positioning relative to an element

And lo, Justin Koivisto didst speak in alt.www.webmaster:

> I am trying to get something to work and am having problems with the
> CSS portion of it. Before I forget, the URL is:
> http://www.minnesotanortheast.com/new-index.php
>
> Basically, it's to function just like an image map, but using CSS
> positioning instead of the MAP and AREA html tags...


Map's with shape="poly" are a lot more flexible for this sort of thing.

> Because the labels
> that are displayed will be chosen by means of a database query, I
> cannot simply create the image maps to do this for each combination.


That doesn't make sense. Why not dynamically add a label popup with DHTML
to each <area> tag? That will do the same thing. Set a loop to go
through the tags and use each tag's title attribute for the popup text.

Alternatively, to eliminate the need for JS, you can have an imagemap
*and* a layer of labels. I did the same sort of thing with a
pseudo-dialogue I built for the Opera browser:

http://www.greywyvern.com/code/opera/Proposal-DPD.html

> Therefore, to do this, I have my php script spit out the necessary HTML
> code which would look like this (simplified):
>
> <div id="nemnmap">
> <img src="/images/nemn-map.jpg">
> <div><img src="cranelake.png"></div>
> <div><img src="duluth.png"></div>
> <div><img src="ely.png"></div>
> </div>


Image maps look quite similar; there's no reason you can't generate them
from the same database. Then you only have to position an image and can
forget about child elements.

> Here's the problem...


[snip]

I seem to remember having the same sort of problems while building the
dialogue I mentioned earlier. My solution was to absolutely position the
box containing the images and labels, while at the same time floating an
empty box of the same dimensions underneath it to supply the text-wrapping
effect.

The fact that you want to position the map at the *bottom* of the
containing box makes it difficult to use this method since you won't be
able to accurately predict where the empty float will land.

Grey

--
The technical axiom that nothing is impossible sinisterly implies the
pitfall corollory that nothing is ridiculous.
- http://www.greywyvern.com - Orca Knowledgebase: Completely CSS styleable
Knowledgebase/FAQ system
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Element Found Woodmonkey Humor 2 01-04-2007 13:34
Effects added to an element Robin Chapple Microsoft Applications 2 10-24-2005 18:04
positioning input box Marge S Microsoft Applications 5 03-04-2005 20:00
Positioning Guides Adrian Microsoft Applications 6 11-02-2004 04:00
Animate element from one slide to another Chuck Elsham Microsoft Applications 3 06-16-2004 06:03


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 11:06.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.77782 seconds with 19 queries