Jump to content

[SOLVED] 2 Column Div Problems


mtylerb

Recommended Posts

Hi (again),

 

I'm trying to make my "Breadcrumb" section in my site display like this:

 

Home -> Archive -> Article                                            RSS Feed

 

Instead, it keeps showing up like:

 

Home -> Archive -> Article

                                                                                                  RSS Feed

 

My div's look like:

 

<div class="path">
	<div class="breadcrumb">
<a href="http://www.tbeckett.net/" title="Home Page">Home Page</a> <span class="breadcrumb-separator">-></span> 
<a href="http://www.tbeckett.net/articles.xhtml" title="Articles">Articles</a> <span class="breadcrumb-separator">-></span> 

<a href="http://www.tbeckett.net/articles/politics.xhtml" title="Politics">Politics</a> <span class="breadcrumb-separator">-></span> 
<span class="breadcrumb-current">Political Leaning</span></div>
</div> <!-- end #path-->
<div class="path" style="text-align: right;">
	<a href="http://www.tbeckett.net/rss"><img src="http://www.tbeckett.net/public/stylesheets/img_dirtylicious/rss.png" alt="rss" style="border: 0px;" /> RSS Feed</a>
</div>

 

I realize div's tend to put a line break after each, but is there a way to override that?  Is there another solution?  The Breadcrumb is hard coded as part of the CMS and so I cannot, easily, change the div class breadcrumb.  So how can I align the RSS link to be on the same line?

 

The site with that exact code is at:  http://www.tbeckett.net/articles/politics/2008/11/09/political-leaning.xhtml

 

Any help is greatly appreciated!

Link to comment
Share on other sites

Ok, this was my solution, but please feel free to tell me if there's a better way of doing this.

 

The function creating the breadcrumbs was $this->breadcrumbs().  So, I str_replaced it like:

 

<?php echo str_replace('</div>','<div style="float:right;position: relative;top:-16px;"><a href="'.BASE_URL.'rss"><img src="'.BASE_URL.'public/stylesheets/img_dirtylicious/rss.png" alt="rss" style="border: 0px;" /> RSS Feed</a></div></div>', $this->breadcrumbs('->')); ?>

 

It seems to be doing what I want it to do, though I'm sure there's better ways to do this.  The page is a fixed width, so I don't think there's going to be too many bugs.

Link to comment
Share on other sites

I did, that's what the str_replace accomplished.  After the str_replace, the code looked like:

 

<div class="path">
      <div class="breadcrumb">
<a href="http://www.tbeckett.net/" title="Home Page">Home Page</a> <span class="breadcrumb-separator">-></span>
<a href="http://www.tbeckett.net/articles.xhtml" title="Articles">Articles</a> <span class="breadcrumb-separator">-></span>

<a href="http://www.tbeckett.net/articles/politics.xhtml" title="Politics">Politics</a> <span class="breadcrumb-separator">-></span>
<span class="breadcrumb-current">Political Leaning</span><div style="float:right;position: relative;top:-16px;"><a href="http://www.tbeckett.net/rss"><img src="http://www.tbeckett.net/public/stylesheets/img_dirtylicious/rss.png" alt="rss" style="border: 0px;" /> RSS Feed</a></div></div>
   </div> <!-- end #path-->

 

As soon as this was in place, IE no longer worked.  FF and Opera did, but IE started displaying the left hand menus below the main content.  After I removed it, IE reverted back to normal.  I'm sure it has something to do with the float.

Link to comment
Share on other sites

I've also tried changing the second part with the RSS link and image to be a span instead of a div and the result is the same.  It's broken in IE.  The code with span instead of div looks like:

 

<div class="path">
      <div class="breadcrumb">
<a href="http://www.tbeckett.net/" title="Home Page">Home Page</a> <span class="breadcrumb-separator">-></span>
<a href="http://www.tbeckett.net/articles.xhtml" title="Articles">Articles</a> <span class="breadcrumb-separator">-></span>

<a href="http://www.tbeckett.net/articles/politics.xhtml" title="Politics">Politics</a> <span class="breadcrumb-separator">-></span>
<span class="breadcrumb-current">Political Leaning</span><span style="float:right;position: relative;top:-16px;"><a href="http://www.tbeckett.net/rss"><img src="http://www.tbeckett.net/public/stylesheets/img_dirtylicious/rss.png" alt="rss" style="vertical-align:middle;border: 0px;" /> RSS Feed</a></span></div>
   </div> <!-- end #path-->

 

I'll leave it like that for now so you can see it, if you want.  It only affects IE, I only have access to IE7, so I don't know about other versions.

Link to comment
Share on other sites

You are floating it towards the right, so put it before the other links like below:

 

<div class="breadcrumb"><span style="float:right;"><a href="http://www.tbeckett.net/rss"><img 

src="http://www.tbeckett.net/public/stylesheets/img_dirtylicious/rss.png" alt="rss" style="vertical-align:middle;border: 

0px;" /> RSS Feed</a></span>
<a href="http://www.tbeckett.net/" title="Home Page">Home Page</a> <span class="breadcrumb-separator">-></span> 
<a href="http://www.tbeckett.net/articles.xhtml" title="Articles">Articles</a> <span class="breadcrumb-separator">-></span> 
<a href="http://www.tbeckett.net/articles/politics.xhtml" title="Politics">Politics</a> <span 

class="breadcrumb-separator">-></span> 
<span class="breadcrumb-current">Political Leaning</span></div>

 

Or remember to clear your float so it doesn't effect the rest of the page flow, like below:

<div class="breadcrumb">
<a href="http://www.tbeckett.net/" title="Home Page">Home Page</a> <span class="breadcrumb-separator">-></span> 
<a href="http://www.tbeckett.net/articles.xhtml" title="Articles">Articles</a> <span class="breadcrumb-separator">-></span> 
<a href="http://www.tbeckett.net/articles/politics.xhtml" title="Politics">Politics</a> <span 

class="breadcrumb-separator">-></span> 
<span class="breadcrumb-current">Political Leaning</span><span style="float:right;position:relative;top:-1.2em;"><a 

href="http://www.tbeckett.net/rss"><img src="http://www.tbeckett.net/public/stylesheets/img_dirtylicious/rss.png" alt="rss" 

style="vertical-align:middle;border: 0px;" /> RSS Feed</a></span><br style="clear:both;"></div>

 

It almost look the same in IE6 as in IE7, so chances are that either of above will fix the issue in IE6 as well as in IE7.  ;D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.