I am using footable in my rails application.I implemented sorting and pagination for a page.Sorting and pagination working fine.But sortable glyphicon icon not showing on table headers.
I have included
In style sheets
footable.core.css
fonts
footable.eot
footable.svg
footable.woff
footable.ttf
In javascript directory
footable.all.min.js
But I didnt get those icons.Is there anything I am missing.Help me.
Hei there, I had the same problem. I just used the predefined Glyphicons instead of the footable ones and it worked.
In the footable.core.css modify like this:
#font-face {
font-family: 'Glyphicons Halflings';
src: url('~/fonts/glyphicons-halflings-regular.eot');
src: url('~/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),
url('~/fonts/glyphicons-halflings-regular.woff') format('woff'),
url('~/fonts/glyphicons-halflings-regular.ttf') format('truetype'),
url('~/fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg'); font-weight: normal;
font-style: normal;
}
#media screen and (-webkit-min-device-pixel-ratio: 0) {
#font-face {
font-family: 'Glyphicons Halflings';
src: url('~/fonts/glyphicons-halflings-regular.svg#footable') format('svg');
font-weight: normal;
font-style: normal;
}
}
.footable.breakpoint > tbody > tr > td > span.footable-toggle {
display: inline-block;
font-family: 'Glyphicons Halflings';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
-webkit-font-smoothing: antialiased;
padding-right: 10px;
text-align:center;
font-size: 14px;
color: #888888;
}
.footable > thead > tr > th > span.footable-sort-indicator {
display: inline-block;
font-family: 'Glyphicons Halflings';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
-webkit-font-smoothing: antialiased;
padding-left: 5px;
}
And voila! It should work. In the code above i just show the snippets that had been modified. For the glyphicons just search "bootstrap glyphicons hex" and will find the codes for any icon you wanna use.
Related
I have a html form generator like this. In this form generator users only can select a font icon from list. I did like it but I need to add new option that user can add custom font icons and uses it.
For implementing this option I try to do it like The Beginner's Guide to Icon Fonts in WordPress but I encountered a issue.
In downloaded custom icon font files exist a style.css file that I added content of them to my website CSS file (I have one CSS file and I can't add two css file for custom icon file) like this:
#font-face {
font-family: ico1;
src: url('fonts/ico1.eot?411a7m');
src: url('fonts/ico1.eot?411a7m#iefix') format('embedded-opentype'),
url('fonts/ico1.ttf?411a7m') format('truetype'),
url('fonts/ico1.woff?411a7m') format('woff'),
url('fonts/ico1.svg?411a7m#ico1') format('svg');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: ico2;
src: url('fonts/ico2.eot?gz3b2b');
src: url('fonts/ico2.eot?gz3b2b#iefix') format('embedded-opentype'),
url('fonts/ico2.ttf?gz3b2b') format('truetype'),
url('fonts/ico2.woff?gz3b2b') format('woff'),
url('fonts/ico2.svg?gz3b2b#ico2') format('svg');
font-weight: normal;
font-style: normal;
}
i {
font-family: ico2, ico1 !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-comprehensive:before {
content: "\e901";
}
.icon-document-center:before {
content: "\e901";
}
If user generates multiple icon fonts with same content ("\e901") like below:
.icon-comprehensive:before {
content: "\e901";
}
.icon-document-center:before {
content: "\e901";
}
And uses this html file:
<i class="icon-comprehensive"></i> // First font icon (ico1)
<i class="icon-document-center"></i> // Second font icon (ico2)
Only the first one ("ico1") is applied for both of i tags. I think this issues related to
font-family: ico2, ico1 !important;
Is there any way to do it?
Thanks advance.
I found a solution for you.
i {
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon1{
font-family: ico1 !important;
}
.icon2{
font-family: ico2 !important;
}
.icon-comprehensive:before {
content: "\e901";
}
.icon-document-center:before {
content: "\e901";
}
And in HTML:
<i class="icon1 icon-comprehensive"></i> // First font icon with .icon1 class
<i class="icon2 icon-document-center"></i> // Second font icon with .icon2 class
Is it possible to configure a donwloadable TTF font to behave the same way than a system font, i.e.:
Font family is stored in several files:
foo.ttf
foob.ttf
fooi.ttf
Font is assigned with the generic family name:
p{
font-family: Foo, serif;
}
Browser picks the appropriate variant automatically:
p.warning{
font-weight: bold;
}
p.note{
font-style: italic;
}
The documentation I've browsed suggests that you need to configure each variant as an entirely different font:
#font-face{
font-family: FooRegular;
src: url(foo.ttf);
font-weight: normal;
font-style: normal;
}
#font-face{
font-family: FooBold;
src: url(foob.ttf);
font-weight: bold;
font-style: normal;
}
#font-face{
font-family: FooItalic;
src: url(fooi.ttf);
font-weight: normal;
font-style: italic;
}
p{
font-family: FooRegular, serif;
}
p.warning{
font-family: FooBold, serif;
font-weight: bold;
}
p.note{
font-family: FooItalic, serif;
font-style: italic;
}
Is it the way it is, or I'm just browsing deprecated/incomplete docs?
It should be something like this:
#font-face{
font-family: Foo;
src: url(foo.ttf);
font-weight: normal;
font-style: normal;
}
#font-face{
font-family: Foo;
src: url(foob.ttf);
font-weight: bold;
font-style: normal;
}
#font-face{
font-family: Foo;
src: url('fooi.ttf');
font-weight: normal;
font-style: italic;
}
p{
font-family: Foo;
}
p.warning{
font-family: FooBold, serif;
font-weight: bold;
}
p.note{
font-family: FooBold, serif;
font-style: italic;
}
That way you add the styles to the same font family.
The fact many tutorials ignore is that you can simply use a single family name and assign it to all rules:
#font-face{
font-family: Foo; /* Just one name */
src: url(foo.ttf);
font-weight: normal;
font-style: normal;
}
#font-face{
font-family: Foo; /* Just one name */
src: url(foob.ttf);
font-weight: bold;
font-style: normal;
}
#font-face{
font-family: Foo; /* Just one name */
src: url(fooi.ttf);
font-weight: normal;
font-style: italic;
}
... thus all the CSS you need is:
p{
font-family: Foo, serif;
/* ^^^ */
}
p.warning{
font-weight: bold;
}
p.note{
font-style: italic;
}
Credit for the info goes to #duvigneau
I am currently using <span class="icon-home2"></span> to show icons in my CSS file:
#font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?4r9x8o');
src: url('fonts/icomoon.eot?4r9x8o#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?4r9x8o') format('truetype'),
url('fonts/icomoon.woff?4r9x8o') format('woff'),
url('fonts/icomoon.svg?4r9x8o#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"], [class*=" icon-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icomoon' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-home:before {
content: "\e900";
}
Now I have a different requirement in which I need show the icons, with content in CSS, using unicode that is mapped here:
.icon-home:before {
content: "\e900";
}
Can anyone tell me how can I achieve this?
I got the answer:
add in css file
[data-icon]:before {
font-family: icomoon; /* BYO icon font, mapped smartly */
content: attr(data-icon);
speak: none; /* Not to be trusted, but hey. */
}
and access with
<i aria-hidden="true" data-icon=""></i>
remember to append &#x before unicode of icons eg icon code is e001 then data-icon=""
I am trying to embed a font with css #font-face as a light font. It works fine in Firefox, but not in IE11. In IE11 font-weights bold and regular work fine, but not font-weight light. In the following code, the text displays as Oswald regular:
#font-face {
font-family: Oswald;
font-weight: 300;
src: url('oswaldlight.eot');
src: url('oswaldlight.eot?#iefix') format('embedded-opentype'), url('oswaldlight.woff') format('woff'), url('oswaldlight.ttf') format('truetype');
}
div.h-title {
font-size: 62px;
letter-spacing: 3px;
font-family: Oswald, sans-serif;
font-weight: 300;
color: #7a7a7a;
text-transform: uppercase;
line-height: 1.3em;
}
I have reviewed the the following similar posting, but the solution they recommend does not work.
#font-face IE9 font-weight doesn't work
In the following code, the text actually displays as sans-serif:
#font-face {
font-family: Oswald-light;
src: url('oswaldlight.eot');
src: url('oswaldlight.eot?#iefix') format('embedded-opentype'), url('oswaldlight.woff') format('woff'), url('oswaldlight.ttf') format('truetype');
}
div.h-title {
font-size: 62px;
letter-spacing: 3px;
font-family: Oswald-light, sans-serif;
color: #7a7a7a;
text-transform: uppercase;
line-height: 1.3em;
}
Any ideas how I could resolve this?
From the start I need to say that I know what I'm trying to do is not "the right way to do it", but the client I'm working for desperately wants THIS specific font.
So, I need to use on a client's website the exact font as VOGUE uses. So I took the .eot & .ttf and uploaded them on my server. Then I added the CSS definitions:
/*fonts fonts for IE*/
#font-face {
font-family: VogueDidot;
src: url('font/FBDidotL-Regular.eot') format('embedded-opentype');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: "VogueDidot Light";
src: url('font/FBDidotL-Light.eot') format('embedded-opentype');
font-weight: normal;
font-style: normal;
}
/*fonts for other browsers*/
#font-face {
font-family: VogueDidot;
src: url('font/FBDidotL-Regular.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
#font-face {
font-family: "VogueDidot Light";
src: url('font/FBDidotL-Light.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
And the CSS for my element is:
.post h1 {
display: block;
height: 100%;
font-family: VogueDidot;
font-size: 55px;
text-transform: uppercase;
overflow: hidden;
line-height: 58px;
}
And, normally, I expected to see everything working like a charm.
But it's not...
Here's how it should look like:
And that's how it looks on my website :
Any ideas?
Looks like the browser is trying to display the font bold and repeating the gray pixels (from the thin lines) next to each other. Try using font-weight: normal (The font-weight:bold is inherited from the h1 element).