Use the @import
method:
@import url('https://fonts.googleapis.com/css?family=Open+Sans&display=swap');
Obviously, “Open Sans” (Open+Sans
) is the font that is imported. So replace it with yours. If the font’s name has multiple words, URL-encode it by adding a +
sign between each word, as I did.
Make sure to place the @import
at the very top of your CSS, before any rules.
Google Fonts can automatically generate the @import
directive for you. Once you have chosen a font, click the (+)
icon next to it. In bottom-left corner, a container titled “1 Family Selected” will appear. Click it, and it will expand. Use the “Customize” tab to select options, and then switch back to “Embed” and click “@import” under “Embed Font”. Copy the CSS between the <style>
tags into your stylesheet.
Related Posts:
- CSS Font Border?
- CSS reset – What exactly does it do?
- When to use margin vs padding in CSS [closed]
- SVG center horizontal and vertical line
- Can I change Bootstrap button color?
- Is it bad practice to comment out single lines of CSS with //?
- How to draw a half circle (border, outline only) [closed]
- CSS Circle with border
- Set parent style via child
- What is the proper way to display a logo with CSS?
- Responsive font size in CSS
- How to make a vertical line in HTML
- How do I change the background color with JavaScript?
- Why em instead of px?
- Vertical Align Center in Bootstrap
- Button Center CSS
- Centering a background image, using CSS
- How to change the cursor into a hand when a user hovers over a list item?
- not:first-child selector
- CSS: center element within a element
- what is a parse error and how do I fix it
- Bootstrap NavBar with left, center or right aligned items
- How to make the overflow CSS property work with hidden as value
- How to make a sticky footer in react?
- How to push a footer to the bottom of page when content is short or missing?
- Linking to a pdf file with html
- Can I add background color only for padding?
- Change TD border color with HTML or CSS
- Why adding version number to CSS file path?
- Hide text using css
- Changing the width of Bootstrap popover
- CSS background color not working
- Bootstrap transparent navbar
- How do I install a custom font on an HTML site
- jQuery toggle CSS?
- 100% DIV width is not really 100%
- CSS 3 slide-in from left transition
- CSS selectors ul li a {…} vs ul > li > a {…}
- Bootstrap scrollable panel
- CSS checkbox input styling
- Is there a CSS selector for elements containing certain text?
- Failed to decode downloaded font
- How to place two divs next to each other?
- Background color in input and text fields
- How can I change the Bootstrap default font family using font from Google?
- CSS3 opacity gradient?
- CSS3 background image transition
- Set line height in Html
to make the html looks like a office word when
has different font sizes
- CSS Equivalent of the “if” statement
- font-weight is not working properly?
- How to make div background color transparent in CSS
- Changing code font size on wordpress
- Lucida calligraphy font not working wordpress site in android chrome
- @font-face doesn’t work
- How to add custom fonts in WordPress site
- How to remove google font in WordPress for only single page?
- How to set different font family based on text language?
- Where Do I Find The Astra Default Font Family That All Text Elements Are Inheriting From? [closed]
- Font Awesome 5 Free – far working but fas is not? [closed]
- How to access theme fonts using custom CSS style? [closed]
- How would one set or override a Fallback font for characters in second language?
- I have a wordpress website which uses a really weird font on Opera. What do I need to do to fix it?
- Font .woff files loaded don’t correspond to the displayed styles [closed]
- When changing theme’s font, why does font-size attribute not work? [duplicate]
- Fonts are not applying
- Fonts are parsed in one way but rendered in a different way
- Custom font isn’t active on all PCs
- Disable all Fonts that are Standard in WordPress and replacing them with a custom Font?
- CSS to make HTML page footer stay at bottom of the page with a minimum height, but not overlap the page
- Using Javascript in CSS
- Why would max-width not work on this?
- Pure CSS to make font-size responsive based on dynamic amount of characters
- In a bootstrap responsive page how to center a div
- How to work with custom styles saved in theme option?
- Modernizr and WordPress – How can I add a CSS class to the html element?
- Adding HTML within an image title attribute
- Adding inline styles from a widget
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Different ways to load child theme css
- How to override Bootstrap css with my child theme css in wordpress?
- How to stop Gutenberg from outputting inline CSS for specific blocks?
- Inside a loop, how to change CSS class based on category name?
- How to make WordPress using local CSS/Fonts/Scripts only
- Place title (in correct place) above image with opaque background [closed]
- Centering one product on a single page [closed]
- How to separate each individual blog post?
- WordPress sidebar content moving to bottom of page
- Making the menu toggled open on mobile devices Illustratr theme
- Site images are fixed in front of my site content [closed]
- Change site title color on individual pages
- Widget edit and add in any page
- Adding a css style to the main nav menu in child pages
- Adding custom css to a theme depending on whether the admin user is logged in or not
- Adding CSS styles to Admin Area PAGES only (not POSTS or CPT)
- Help with changing style of the extended menu drop down [closed]
- Adjusting post width according to the image size
- Stop underlining image links
- To override CSS of parent theme
- WordPress site suddenly not showing some DOM elements but mobile is fine
- Content doesn’t fit on large size desktops like 2560×1440