How do I add a custom image icon to my navigation menu? - html

I am using a template website, but need to add a different icon to each of the pages in the navigation menu. How can I do this without using a icon web font?
<ul class="chevron">
<li><i class="icon-list"></i>Home</li>
<li><i class="icon-camera"></i>About Me</li>
<li><i class="icon-heart"></i>What is Occupational Therapy?
<li><i class="icon-heart"></i>Why it works
</li>
<li><i class="icon-heart"></i>Pricing</li>
<li><i class="icon-heart"></i>Q&A</li>
<li><i class="icon-heart"></i>Links</li>
<li><i class="icon-mail"></i>Contact</li>
</ul>

You can simply use an image.
<ul class="chevron">
<li>Link 1 <img src="..." alt="..."></li>
<li>Link 2 <img src="..." alt="..."></li>
<li>Link 3 <img src="..." alt="..."></li>
</ul>
Then, in your CSS, you can target the image to give it a more appropriate width/height if it's not already scaled.
ul.chevron li img{
width: 50px;
}

(Copied from my comment. Even if OP doesn't have the SVG file, maybe this will prove useful to other users)
Do you have an SVG file for the icon font? You could import an SVG version of the font into http://icomoon.io/app and supplement with their free font sets. I'm sure there's one in there you could use. I only mention icomoon because it's the only one I've ever used but http://fontello.com could work too.
You would import the SVG, select all of the icons, select any additional icons from the other icon sets, and then export the combined set. You may have to change the names or adjust your stylesheet, but this should get you a working set that you can then use instead.

Related

Odd rendering for font-awsome

From time to time after page refresh fontawesome icons get this rendered this way:
When they should look like this:
Is there anything I am missing my html or CSS?
This is the HTML to display each of those menu options is as simple as:
<li class=""><a ui-sref="Resources" title="Resources">
<i class="fa fa-lg fa-fw fa-globe"></i>
<span class="menu-item-parent ng-binding">Resources</span>
<b class="collapse-sign"><em class="fa fa-plus-square-o"></em></b></a>
</li>
The parent elements for the menu are:
<aside id="left-panel"><nav nav-menu="" stopwatch="true">
<ul><li><!--menu time --></li>
It seems something like mojibake. It could depend on the files (css and html) or document encoding. The file one should be utf-8 without bom.

How to put google font (chevron_right) at front of a link in html?

I am using google fonts in html and I want to put a google font (chevron_icon) at the front of a link but the problem is that it is placing it under the link instead of front. Here is my code.
<div class="mobile-navigation">
<ul id = "mobile-nav" class="side-nav">
<li>
Fashion <i class="material-icons">chevron_right</i>
<ul id = "submenu1">
<li>Shirts</li>
<li>Jackets</li>
<li>Jeans</li>
<li>T-Shirts</li>
<li>Underwear</li>
</ul>
</li>
<li>
Electronics
</li>
</ul>
</div>
The output that it shows is something like this.
File
>
Electronics
I want the following output.
File>
Electronics
You are placing the chevron in the wrong place, you need to put it like so:
Fashion <i class="material-icons">> (chevron_right)</i>
Here is a working fiddle: https://jsfiddle.net/vtkLy29r/1/
Try this instead
Fashion <i class="material-icons">chevron_right</i>

add class to individual list item in wordpress

Problem
I am using wordpress and fontawesome icon library to add icon to each list item. I have added class to each list item by enabling "CSS Classes" from "Show advanced menu properties" from Screen option. I tried wp_nav_menu and various other tricks but failed to output class like fa fa-home
Code
<ul id="primary-menu">
<li><i class="fa fa-home"></i>home</li>
<li><i class="fa fa-user"></i>About</li>
<li><i class="fa fa-camera"></i>Gallery</li>
<li><i class="fa fa-gift"></i>Shop</li>
<li><i class="fa fa-bullhorn"></i>Blog</li>
<li><i class="fa fa-envelope"></i>contact
</ul><!-- #primary-menu -->
I want to output those classes individually to each "i" element in list item. Please, suggest any code snippets or walk-through.
This code (from your question) is not standard WP code - yours is including <i> elements:
<ul id="primary-menu">
<li><i class="fa fa-home"></i>home</li>
</ul>
WP outputs menus like so, without the <i> element:
<ul class="menu">
<li id="menu-item-8" class="fa fa-home menu-item menu-item-type-post_type menu-item-object-page menu-sample-page">
Sample Page
</li>
</ul>
Notice the class fa fa-home on the <li> element above? That was added by adding the class (just like you described). Additionally, it created the icon desired in the menu.
If you aren't getting the icon, ensure that font awesome is actually being loaded, and that the font files are installed and in the right directory relative to the font awesome stylesheet.
How are you adding the <i> elements? The only way you could achieve this (using the technique you are trying to use) would be to Write a custom menu walker, but that's a lot of work to add the icons, since you an add them simply by editing the class via the Menu dashboard.

Change Sphinx's template for table of contents

I am using Sphinx with my own template to get a documentation style like the twitter bootstrap documentation: http://getbootstrap.com/2.3.2/getting-started.html
There you can see the navigation on the left, which is static and stays at the same place as you scroll.
It is therefore nescessary to render the table of contents which I already achieved with this function:
{{ toctree(maxdepth=1, collapse=False, includehidden=true) }}
That outputs me the following:
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="#installation">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="#roadmap">Roadmap</a></li>
</ul>
But in order to let it work with bootstrap I need the following output:
<ul class="nav nav-list bs-docs-sidenav">
<li><i class="icon-chevron-right"></i> Introduction</li>
<li><i class="icon-chevron-right"></i> Installation</li>
<li><i class="icon-chevron-right"></i> Roadmap</li>
</ul>
So my question is: How can I achieve that? Is there a template file for the toctree() function I can adjust?
I had a similar problem and i used a mixed of self defined roles and jQuery to adjust this issues based on my role placement. jQuery will change all the stuff y need.

Is there any way to stop Visual Studio from removing empty spaces after Ctrl+E+D

I've got a view that has the following code:
<ul class="nav nav-tabs">
<li class="active"><i class="icon-home"></i> General</li>
<li><i class="icon-picture"></i> Background</li>
<li><i class="icon-edit"></i> Form Container</li>
<li><i class="icon-picture"></i> Logo</li>
<li><i class="icon-tint"></i> Colors</li>
<li><i class="icon-font"></i> Fonts</li>
</ul>
The classes and html attributes are from Twitter Bootstrap but that's not important.
After pressing Ctrl+E+D combination the following code gets changed:
<i class="icon-home"></i> General to <i class="icon-home"></i>General
I also tried putting an empty space between the <i> tags but it gets stripped out as well.
This is effectively moving the tab title closer to the icon and although it's easy to fix I don't want to have to do it every time I benefit from auto code formatting in Visual Studio.
Is there any way to change/tweak this behaviour?
You can play with things here :: Tools/Options/Text Editor/HTML/Formatting
You'll find it a little arduous at times to get things exactly the way you want them, but if there's a way to adjust your spacing, that would be where it is located.