How to embed fonts in CSS?


Tags: css,fonts

Problem :

I want to use some fonts and I want it to work without having this font on the client computer. I have done this but doesn't work:

@font-face {
    font-family: EntezareZohoor2;
    src: url(Entezar2.ttf) format("truetype");
}

.EntezarFont{
    font-family: EntezareZohoor2, B Nazanin, Tahoma !important;
}


Solution :

Following lines are used to define a font in css

@font-face {
    font-family: 'EntezareZohoor2';
    src: url('fonts/EntezareZohoor2.eot'), url('fonts/EntezareZohoor2.ttf') format('truetype'), url('fonts/EntezareZohoor2.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

Following lines to define/use the font in css

#newfont{
    font-family:'EntezareZohoor2';
}

    CSS Howto..

    How do I assign an external CSS file to a javascript-constructed SVG object?

    jQuery/HTML Select: Show more text in selected option when select is closed

    How to remove jquery mobile button color or override button css?

    how to display a list inline using HTML and CSS

    How can I get li items to slide and/or fade into view on this jQuery list?

    My YouTube video wont show in iframe

    CSS How to animate a transition from opacity 0 upon hover

    How to change this FontAwesome to image in Css?

    How slow is * css selector for mobile browsers?

    How do I keep an image and text centered vertically with bootstrap?

    How can I make jQuery's draggable function expand the container?

    how do I give partition in the
    tag?

    How can I align an image to the center in a Bootstrap column?

    How to read minified CSS?

    How can I write CSS with jQuery (or JS) to apply to current and future matches?

    How to use weather API to create my weather HTML page [closed]

    How can I rotate a font icon 45 degrees?

    How to calculate effective CSS for a DOM node using PHP

    I have a link icon next to each link. How do I exclude the link icon from images?

    CSS: How to refer to a tag

    How to detect clicks outside of a css modal? [duplicate]

    How to achieve this header with html and css?

    How to use animation with transform CSS

    How to do Background Image horizontal slide

    css: how to target p a img

    How to remove strange border from css-animated clip-path?

    How to conditionally load CSS

    How to apply css rules to html element using ExtJS?

    CSS 3D containers like shown in post

    how to increase the size of background image to cover all backgroung (but no repetition) [closed]