Web Design Forum  
 
Go Back   Web Design Forum > Web and Graphic Design > Web Design

Reply
 
LinkBack Thread Tools Display Modes
Old 09-11-2007, 07:15 PM   #1 (permalink)
New Member
 
Join Date: Aug 2007
Posts: 2
Default Put 2 elements in the same place

How do I put 2 elements in the same place? I have the following code on my page:

Code:
    <SPAN ID="link1">                                
      <A HREF="url1">Click on link1</a>   
    </SPAN>   

    <SPAN ID="link2">                                
      <A HREF="url2">Click on link2</a>   
    </SPAN>
Now elsewhere on the page, I use JavaScript so that either link1 or link 2 (but not both) are visible using the visibility attribute. Depending on what's going on with the rest of the page, only one of these links is active. Users can do things on the page so that it will toggle.

My problem is that I want both links to come up in the exact same spot. The way things are now, link2 will come up to the right of where link1 was before it became invisible. This make sense, because link1 still technically exists, it is just invisible. But that isn't what I want.

Any idea on how I can accomplish what I want? I've seen something about using innerHTML, but it sounds non-standard and kind of dangerous. What's the official way to do something like this?
smithsa is offline   Reply With Quote
Old 09-12-2007, 01:57 AM   #2 (permalink)
Bronze Member
 
Join Date: Jun 2006
Posts: 26
Send a message via ICQ to timothyb89 Send a message via AIM to timothyb89 Send a message via MSN to timothyb89 Send a message via Yahoo to timothyb89 Send a message via Skype™ to timothyb89
Default

Try using CSS for that. Replace the <SOME AMOUNT HERE> text and the examples with your own value.
HTML Code:
<SPAN ID="link1" style="position: absolute; margin-top: <SOME AMOUNT IN % OR px. Ex: >10%; margin-left: <ANOTHER AMOUNT. EX: >50px">                                
    <A HREF="url1">Click on link1</a>   
</SPAN>   

<SPAN ID="link2" style="position: absolute; margin-top: <SOME AMOUNT IN % OR px. Ex: >10%; margin-left: <ANOTHER AMOUNT. EX: >50px">                                
    <A HREF="url2">Click on link2</a>   
</SPAN>
__________________
My Site: http://timothyb89.homelinux.org/
timothyb89 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


All times are GMT. The time now is 04:01 AM.


Computer Forum - Internet Business - Webpage Design

 
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.