[SOLVED] <a> links on same line with 'floating' (not &nbsp; ) space between ?
akm Offline
Member
***
Posts: 115
Joined: Nov 2011
Post: #1
Question [SOLVED] <a> links on same line with 'floating' (not &nbsp; ) space between ?
Trying to put a couple text/object links on page at opposite sides of the page and on the same line (per code below).

&nbsp; sort-of works, but wraps text/objects prematurely when page window is made smaller.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<div>  
<style="float: left; text-align: left;">
<a href="{$mybb->settings['bburl']}/search.php">
<img src="{$theme['imgdir']}/toplinks/search.gif" alt="" title="">
{$lang->toplinks_search}
</a>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<style="float: right; text-align: left;">
<a href="http://www.forum.info/index.htm"> 
<font size="4;" color="#0066CC"> Go to Location (click here)</font>
</a>
</div>



Tried looking at places like http://www.w3schools.com/tags/ etc, but seems like there is not a good spacer tag that does what need.

Suggestions on place/s to look ?

Also, any other comments on way trying (ie code crudeness) to do it would be appreciated.

Ps: Sorry for all the beginner mod questions. If not wanted, please let know better place to post.


Thanks again for your help !
(This post was last modified: 03-28-2012 06:16 AM by akm.)
02-20-2012 11:12 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #2
RE: How to put <a> links on same line with 'floating' (not &nbsp; ) space in between ???
Why not using the white-space property or the margin one?

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
02-20-2012 11:38 AM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #3
RE: How to put <a> links on same line with 'floating' (not &nbsp; ) space in between ???
You could try  this :

HTML Code
<div style="width:100%;">
<div><a href="http://www.leefish.nl/mybb/portal.php">HALLO</a></div>
<div style="float:right;margin-top:-25px;"><a href="http://www.forum.info/index.htm">goodbye</a></div>
</div>



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 02-20-2012 12:17 PM by leefish.)
02-20-2012 12:17 PM
Visit this user's website Find all posts by this user Quote this message in a reply
akm Offline
Member
***
Posts: 115
Joined: Nov 2011
Post: #4
RE: How to put <a> links on same line with 'floating' (not &nbsp; ) space in between ???
(02-20-2012 11:38 AM)Sama34 Wrote:  Why not using the white-space property or the margin one?

Thanks much !
Added to code (hope did right) below (part of template: header) and works like advertised.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<head>
<style type="text/css">
p
{
white-space:nowrap;
}
</style>
</head>
<div>  
<p>
<a href="{$mybb->settings['bburl']}/search.php">
<img src="{$theme['imgdir']}/toplinks/search.gif" alt="" title="">
{$lang->toplinks_search}
</a>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

<a href="http://www.forum.info/index.htm"> 
<font size="4;" color="#0066CC"> Go to Location (click here)</font>
</a>
</div>


Also looking at if possible to make so <a> text links on each side be able to wrap on each other without crossing the 'space' in between ?


Thanks again for your help !
02-20-2012 12:36 PM
Find all posts by this user Quote this message in a reply
akm Offline
Member
***
Posts: 115
Joined: Nov 2011
Post: #5
RE: How to put <a> links on same line with 'floating' (not &nbsp; ) space in between ???
(02-20-2012 12:17 PM)leefish Wrote:  You could try  this :

HTML Code
<div style="width:100%;">
<div><a href="http://www.leefish.nl/mybb/portal.php">HALLO</a></div>
<div style="float:right;margin-top:-25px;"><a href="http://www.forum.info/index.htm">goodbye</a></div>
</div>


Thank you for the suggestion !
Tried and got scrnshot attached.

Think did it per suggestion, but may have missed something ?...

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
<div style="width:100%;">
<div>
<a href="{$mybb->settings['bburl']}/search.php">
<img src="{$theme['imgdir']}/toplinks/search.gif" alt="" title="">
{$lang->toplinks_search}
</a>
</div>
<div style="float:right;margin-top:-25px;">
<a href="http://www.homepage.info/index.htm"> 
Return to homepage (click here)
</a>
</div>
</div>



Attached File(s) Thumbnail(s)
   

Thanks again for your help !
(This post was last modified: 02-20-2012 07:32 PM by akm.)
02-20-2012 07:29 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #6
RE: How to put <a> links on same line with 'floating' (not &nbsp; ) space in between ???
Hmm. It looks like the default font size and also that the div is inheriting from something higher up on the page. I just ran that through FF on a page with no CSS using default browser and it behaved as expected. Are you trying for a tableless theme?

If you don't mind using tables then the default template forum display threadlist pretty much does what you are looking for - look at the default on threadlist - title on the left and subscribe to thread on the right.


[Image: leelink.gif]
MYBB1.6 & XThreads
02-22-2012 03:40 AM
Visit this user's website Find all posts by this user Quote this message in a reply
akm Offline
Member
***
Posts: 115
Joined: Nov 2011
Post: #7
RE: How to put <a> links on same line with 'floating' (not &nbsp; ) space in between ???
(02-22-2012 03:40 AM)leefish Wrote:  Hmm. It looks like the default font size and also that the div is inheriting from something higher up on the page. I just ran that through FF on a page with no CSS using default browser and it behaved as expected. Are you trying for a tableless theme?
If you don't mind using tables then the default template forum display threadlist pretty much does what you are looking for - look at the default on threadlist - title on the left and subscribe to thread on the right.

Thanks much !
Tables worked fine.
Just took me a while to get back to the question and learn a bit about tables.

Thanks again for your help !
03-28-2012 06:20 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: