MNM MNM - 1 month ago 6
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,

.a
{
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;

<SCRIPT LANGUAGE="JavaScript">
<!--
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> \>\> ";
}
i=s.length-1;
path+="<A HREF=\""+href.substring(0,href.indexOf(s[i])+s[i].length)+"\">"+s[i]+"</A>";
var url = path;
document.write(url);
//-->
</script>


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

Your css should be:

a
{
   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
Comments