MNM MNM - 1 year ago 77
HTML Question

Apply CSS to a generated href

I am generating links from a java script to created a breadcrumb for my sight. It works perfectly, but.... I want to put all the link in a line like this,

display: inline;
float : left;
font: 18px Helvetica, Arial, Sans-Serif;

but I don't know where to put the css to make it pretty.
Here is the javascript that is inside the body of the html;

var path = "";
var href = document.location.href;
var s = href.split("/");
for (var i=2;i<(s.length-1);i++) {
path+="<A HREF=\""+href.substring(0,href.indexOf("/"+s[i])+s[i].length+1)+"/\">"+s[i]+"</A> \>\> ";
path+="<A HREF=\""+href.substring(0,href.indexOf(s[i])+s[i].length)+"\">"+s[i]+"</A>";
var url = path;

Right now the links are one on top of each other with the >> at the left side of the page.
I want them to be inline horizontally with the >> in-between them.

Answer Source

Your css should be:

   display: inline-block;
   font: 18px Helvetica, Arial, Sans-Serif; 
  1. You are calling .a class instead of a
  2. You don't need to use float: left for this case
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download