2017-06-14 2 views
-1

Ich versuche, verschiedene Formen der gleichen Schriftart in meinem Projekt zu deklarieren. Ich möchte eine normal und italic Version jeder Schriftart unter der gleichen BrandonText Namen. Sobald ich die italic Version in, die normal Version wird vollständig ignoriert.Kursiv überschreibt Standard?

@font-face { 
    font-family: 'BrandonText'; 
    src: url('/fonts/BrandonText-Thin.eot?#iefix') format('embedded-opentype'), 
      url('/fonts/BrandonText-Thin.otf') format('opentype'), 
      url('/fonts/BrandonText-Thin.woff') format('woff'), 
      url('/fonts/BrandonText-Thin.ttf') format('truetype'), 
      url('/fonts/BrandonText-Thin.svg#BrandonText-Thin') format('svg'); 
    font-weight: 100; 
    font-style: normal; 
} 

@font-face { 
    font-family: 'BrandonText'; 
    src: url('/fonts/BrandonText-Thin.eot?#iefix') format('embedded-opentype'), 
      url('/fonts/BrandonText-Thin.otf') format('opentype'), 
      url('/fonts/BrandonText-Thin.woff') format('woff'), 
      url('/fonts/BrandonText-Thin.ttf') format('truetype'), 
      url('/fonts/BrandonText-Thin.svg#BrandonText-Thin') format('svg'); 
    font-weight: 100; 
    font-style: italic; 
} 

Warum ist das, und gibt es eine Möglichkeit, dies zu umgehen?

+0

Was wird ignoriert, wo? – CBroe

+0

@CBroe In meiner Website ist jede Schriftart, die "BrandonText" (die überall sein wird) verwendet kursiv, unabhängig davon, was im CSS für die Website-Komponente deklariert ist. Ich möchte in der Lage sein, mehrere Gewichtungen/Stile unter einem Schriftartnamen zu deklarieren. – Crowes

+0

@CBroe Ich denke, er meint, seine ganze Kopie ist jetzt kursiv. – Gezzasa

Antwort

1

Sie überschreiben Ihre normalen @font-face durch kursive. Stattdessen deklarieren Sie es einfach einmal:

@font-face { 
    font-family: 'BrandonText'; 
    src: url('/fonts/BrandonText-Thin.eot?#iefix') format('embedded-opentype'), 
      url('/fonts/BrandonText-Thin.otf') format('opentype'), 
      url('/fonts/BrandonText-Thin.woff') format('woff'), 
      url('/fonts/BrandonText-Thin.ttf') format('truetype'), 
      url('/fonts/BrandonText-Thin.svg#BrandonText-Thin') format('svg'); 
    font-weight: 100; 
} 

Dann können Sie die gleiche Deklaration für beide Fälle verwenden. Wenn Sie kursiv schreiben möchten, fügen Sie einfach font-style: italic zu Element's CSS hinzu.

0

Beide sind mit dem gleichen Namen erklärt

Ihr zweites font-family ändern: 'BrandonText'; zur Schriftfamilie: 'BrandonTextItalic';

1

Sie haben beiden Schriftarten den gleichen Namen gegeben. Wechseln Sie dazu.

@font-face { 
    font-family: 'BrandonText'; 
    src: url('/fonts/BrandonText-Thin.eot?#iefix') format('embedded-opentype'), 
      url('/fonts/BrandonText-Thin.otf') format('opentype'), 
      url('/fonts/BrandonText-Thin.woff') format('woff'), 
      url('/fonts/BrandonText-Thin.ttf') format('truetype'), 
      url('/fonts/BrandonText-Thin.svg#BrandonText-Thin') format('svg'); 
    font-weight: 100; 
    font-style: normal; 
} 

@font-face { 
    font-family: 'BrandonTextItalic'; 
    src: url('/fonts/BrandonText-Thin.eot?#iefix') format('embedded-opentype'), 
      url('/fonts/BrandonText-Thin.otf') format('opentype'), 
      url('/fonts/BrandonText-Thin.woff') format('woff'), 
      url('/fonts/BrandonText-Thin.ttf') format('truetype'), 
      url('/fonts/BrandonText-Thin.svg#BrandonText-Thin') format('svg'); 
    font-weight: 100; 
    font-style: italic; 
} 
Verwandte Themen