How to use OfficeUI Fabric global typography rules with officeui fabric react app?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I'm troubled regarding using fabric typography in a react application.
I want to build an app that looks like fabric.
How to get typography rules ?
Especially, I want <h1>,<h2> tags to looks fabric headers.
I tries to import the css from my global layout component, but headers are still raw.
import 'office-ui-fabric-react/dist/css/fabric.min.css';
I also tried to reference the CDN css file using
<link
rel="stylesheet"
href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css"
/>
But still without success.
[Edit]Please note that within components styles are applied. For example, a h1 tag within a Dialog component will show as expected.
[/Edit]
office-ui-fabric
add a comment |
I'm troubled regarding using fabric typography in a react application.
I want to build an app that looks like fabric.
How to get typography rules ?
Especially, I want <h1>,<h2> tags to looks fabric headers.
I tries to import the css from my global layout component, but headers are still raw.
import 'office-ui-fabric-react/dist/css/fabric.min.css';
I also tried to reference the CDN css file using
<link
rel="stylesheet"
href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css"
/>
But still without success.
[Edit]Please note that within components styles are applied. For example, a h1 tag within a Dialog component will show as expected.
[/Edit]
office-ui-fabric
add a comment |
I'm troubled regarding using fabric typography in a react application.
I want to build an app that looks like fabric.
How to get typography rules ?
Especially, I want <h1>,<h2> tags to looks fabric headers.
I tries to import the css from my global layout component, but headers are still raw.
import 'office-ui-fabric-react/dist/css/fabric.min.css';
I also tried to reference the CDN css file using
<link
rel="stylesheet"
href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css"
/>
But still without success.
[Edit]Please note that within components styles are applied. For example, a h1 tag within a Dialog component will show as expected.
[/Edit]
office-ui-fabric
I'm troubled regarding using fabric typography in a react application.
I want to build an app that looks like fabric.
How to get typography rules ?
Especially, I want <h1>,<h2> tags to looks fabric headers.
I tries to import the css from my global layout component, but headers are still raw.
import 'office-ui-fabric-react/dist/css/fabric.min.css';
I also tried to reference the CDN css file using
<link
rel="stylesheet"
href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css"
/>
But still without success.
[Edit]Please note that within components styles are applied. For example, a h1 tag within a Dialog component will show as expected.
[/Edit]
office-ui-fabric
office-ui-fabric
edited Jan 3 at 13:25
Steve B
asked Jan 3 at 13:13
Steve BSteve B
28.6k1376136
28.6k1376136
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can only use the typography defined in https://developer.microsoft.com/en-us/fabric#/styles/typography, make sure you place the correct class names for the header you want. And make sure you wrap the html with ms-Fabric. If you are using react, <Fabric> does that for you too.
For example:
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css">
<body class="ms-Fabric">
<h1 class="ms-font-xl">Hello World</h1>
<h1 class="ms-font-su">Hello World</h1>
</body>There are two ways to include the Fabric Core.
Via CDN, Example CDNs are https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css or https://unpkg.com/office-ui-fabric-react@6.119.0/dist/css/fabric.min.css (use a prod ready cdn)
Via NPM, Once you
yarn add office-ui-fabric-reactornpm install office-ui-fabric-reactin yourindex.cssorindex.sassjust import it. Webpack will make sure it packs everything correctly.
css:
@import '../node_modules/office-ui-fabric-react/dist/css/fabric.css';
sass:
@import '../node_modules/office-ui-fabric-react/dist/sass/Fabric';
Note: This will bring all fabric styles (which is the only way), later on, the Fabric team stated they will create components instead of doing this.
That's all
1
Thanks. You pointed me to the right direction. I was able to mimic what I wanted by defaulting headers behaviors with sass rules likeh1 { @extend .ms-font-su; }. this way all h1 behaves as I expected
– Steve B
Jan 3 at 15:16
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54023016%2fhow-to-use-officeui-fabric-global-typography-rules-with-officeui-fabric-react-ap%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can only use the typography defined in https://developer.microsoft.com/en-us/fabric#/styles/typography, make sure you place the correct class names for the header you want. And make sure you wrap the html with ms-Fabric. If you are using react, <Fabric> does that for you too.
For example:
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css">
<body class="ms-Fabric">
<h1 class="ms-font-xl">Hello World</h1>
<h1 class="ms-font-su">Hello World</h1>
</body>There are two ways to include the Fabric Core.
Via CDN, Example CDNs are https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css or https://unpkg.com/office-ui-fabric-react@6.119.0/dist/css/fabric.min.css (use a prod ready cdn)
Via NPM, Once you
yarn add office-ui-fabric-reactornpm install office-ui-fabric-reactin yourindex.cssorindex.sassjust import it. Webpack will make sure it packs everything correctly.
css:
@import '../node_modules/office-ui-fabric-react/dist/css/fabric.css';
sass:
@import '../node_modules/office-ui-fabric-react/dist/sass/Fabric';
Note: This will bring all fabric styles (which is the only way), later on, the Fabric team stated they will create components instead of doing this.
That's all
1
Thanks. You pointed me to the right direction. I was able to mimic what I wanted by defaulting headers behaviors with sass rules likeh1 { @extend .ms-font-su; }. this way all h1 behaves as I expected
– Steve B
Jan 3 at 15:16
add a comment |
You can only use the typography defined in https://developer.microsoft.com/en-us/fabric#/styles/typography, make sure you place the correct class names for the header you want. And make sure you wrap the html with ms-Fabric. If you are using react, <Fabric> does that for you too.
For example:
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css">
<body class="ms-Fabric">
<h1 class="ms-font-xl">Hello World</h1>
<h1 class="ms-font-su">Hello World</h1>
</body>There are two ways to include the Fabric Core.
Via CDN, Example CDNs are https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css or https://unpkg.com/office-ui-fabric-react@6.119.0/dist/css/fabric.min.css (use a prod ready cdn)
Via NPM, Once you
yarn add office-ui-fabric-reactornpm install office-ui-fabric-reactin yourindex.cssorindex.sassjust import it. Webpack will make sure it packs everything correctly.
css:
@import '../node_modules/office-ui-fabric-react/dist/css/fabric.css';
sass:
@import '../node_modules/office-ui-fabric-react/dist/sass/Fabric';
Note: This will bring all fabric styles (which is the only way), later on, the Fabric team stated they will create components instead of doing this.
That's all
1
Thanks. You pointed me to the right direction. I was able to mimic what I wanted by defaulting headers behaviors with sass rules likeh1 { @extend .ms-font-su; }. this way all h1 behaves as I expected
– Steve B
Jan 3 at 15:16
add a comment |
You can only use the typography defined in https://developer.microsoft.com/en-us/fabric#/styles/typography, make sure you place the correct class names for the header you want. And make sure you wrap the html with ms-Fabric. If you are using react, <Fabric> does that for you too.
For example:
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css">
<body class="ms-Fabric">
<h1 class="ms-font-xl">Hello World</h1>
<h1 class="ms-font-su">Hello World</h1>
</body>There are two ways to include the Fabric Core.
Via CDN, Example CDNs are https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css or https://unpkg.com/office-ui-fabric-react@6.119.0/dist/css/fabric.min.css (use a prod ready cdn)
Via NPM, Once you
yarn add office-ui-fabric-reactornpm install office-ui-fabric-reactin yourindex.cssorindex.sassjust import it. Webpack will make sure it packs everything correctly.
css:
@import '../node_modules/office-ui-fabric-react/dist/css/fabric.css';
sass:
@import '../node_modules/office-ui-fabric-react/dist/sass/Fabric';
Note: This will bring all fabric styles (which is the only way), later on, the Fabric team stated they will create components instead of doing this.
That's all
You can only use the typography defined in https://developer.microsoft.com/en-us/fabric#/styles/typography, make sure you place the correct class names for the header you want. And make sure you wrap the html with ms-Fabric. If you are using react, <Fabric> does that for you too.
For example:
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css">
<body class="ms-Fabric">
<h1 class="ms-font-xl">Hello World</h1>
<h1 class="ms-font-su">Hello World</h1>
</body>There are two ways to include the Fabric Core.
Via CDN, Example CDNs are https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css or https://unpkg.com/office-ui-fabric-react@6.119.0/dist/css/fabric.min.css (use a prod ready cdn)
Via NPM, Once you
yarn add office-ui-fabric-reactornpm install office-ui-fabric-reactin yourindex.cssorindex.sassjust import it. Webpack will make sure it packs everything correctly.
css:
@import '../node_modules/office-ui-fabric-react/dist/css/fabric.css';
sass:
@import '../node_modules/office-ui-fabric-react/dist/sass/Fabric';
Note: This will bring all fabric styles (which is the only way), later on, the Fabric team stated they will create components instead of doing this.
That's all
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css">
<body class="ms-Fabric">
<h1 class="ms-font-xl">Hello World</h1>
<h1 class="ms-font-su">Hello World</h1>
</body> <link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/9.6.1/css/fabric.min.css">
<body class="ms-Fabric">
<h1 class="ms-font-xl">Hello World</h1>
<h1 class="ms-font-su">Hello World</h1>
</body>edited Jan 3 at 14:13
answered Jan 3 at 13:54
Mohamed MansourMohamed Mansour
31.7k610083
31.7k610083
1
Thanks. You pointed me to the right direction. I was able to mimic what I wanted by defaulting headers behaviors with sass rules likeh1 { @extend .ms-font-su; }. this way all h1 behaves as I expected
– Steve B
Jan 3 at 15:16
add a comment |
1
Thanks. You pointed me to the right direction. I was able to mimic what I wanted by defaulting headers behaviors with sass rules likeh1 { @extend .ms-font-su; }. this way all h1 behaves as I expected
– Steve B
Jan 3 at 15:16
1
1
Thanks. You pointed me to the right direction. I was able to mimic what I wanted by defaulting headers behaviors with sass rules like
h1 { @extend .ms-font-su; }. this way all h1 behaves as I expected– Steve B
Jan 3 at 15:16
Thanks. You pointed me to the right direction. I was able to mimic what I wanted by defaulting headers behaviors with sass rules like
h1 { @extend .ms-font-su; }. this way all h1 behaves as I expected– Steve B
Jan 3 at 15:16
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54023016%2fhow-to-use-officeui-fabric-global-typography-rules-with-officeui-fabric-react-ap%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
