Using Google Fonts with @import is causing a display issue

I am attempting to import Google Fonts into my project. Here is the code I have used:

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600&subset=latin,cyrillic);

For various elements, I am applying different font-weight properties - 300, 400, 600.

However, it seems that the fonts are not displaying correctly. Can anyone help me identify what I may have missed?

Answer №1

Everything is functioning as expected without any issues.

To view a demonstration of this, check out the example on CodePen: http://codepen.io/sampson/pen/eBVYjm

@import url(https://fonts.googleapis.com/css?family=Roboto:400,300,500&subset=latin,cyrillic);

body{
  font-family: 'Roboto';
}
.noStyleP{
  font-family: sans-serif;
  font-weight: normal;
}
.p1{
  font-weight: 300;
}
.p2{
  font-weight: 400;
}
.p3{
  font-weight: 500;
}
.p4{
  font-weight: normal;
}

Answer №2

Unfortunately, the code is malfunctioning due to a typo:

Instead of font-weigth, it should be font-weight.

Answer №3

@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300,600&subset=latin,cyrillic);

is now changed to

@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300,600&subset=latin,cyrillic);

At times, the https:// link may not function properly with Google because of a flawed SSL certificate. Give the http:// link a try instead!!!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with the styling of the fourth level menu option persists

I'm stuck trying to style the fourth level and can't figure out why. Would really appreciate some help untangling this CSS mess! Check out the Fiddler: Menu Demo ...

Can you restrict the selection of text to only the current element?

<div class="container"> <div class="item1">text text text in div element 1</div> <div class="item2">text text text in div element 2</div> </div> Is there a way using HTML nodes, CSS, or JavaScript to restrict the select ...

Unable to link href attribute in project

My issue is that clicking the updates button does not load its page. Here's the relevant part of the code: <div class="st-container"> <input type="radio" name="radio-set" checked="checked" id="st-control-1"/> <a href="home.html ...

The command entered is not valid for 'text/css'. It is possible that there was a typo or the command is from a module that is not configured in

We are currently using Laravel 5.4 on a Linux server with Apache. Recently, we started encountering the following error in our /var/log/httpd/error_log file even though there have been no changes made to our .htaccess file: /var/www/html/public/.htaccess: ...

A photograph displayed within a container using Bootstrap, positioned on the right-hand side

I'm facing an issue with my container setup that includes row > col > img. I need the image to be positioned close to the page border. So far, I have tried making the site responsive using margin-right: -n px, but it doesn't work on mobil ...

The form submission is not affected by the jQuery dialog buttons and will proceed to submit as

I'm struggling with a form and JavaScript code interaction. In my code, when the validateDialogForm() function is called, a jQuery dialog appears under certain conditions. The issue is that the dialog only shows for a few seconds before the form conti ...

What is the best way to end a column early using a media query?

I need some help with adjusting the card layout in my project. I want the cards to break at a specific window size of 700px, but it's not working as expected. Can anyone provide guidance on how to achieve this? Thank you in advance for your assistance ...

Tips for increasing the size of the SVG icon within Material UI iconButtons

Have you experimented with creating webpages using react.js along with the Material UI library? How can I adjust the size of an SVG icon? Recently, I developed a "create new" component, which consists of a material paper element with an add button on top. ...

The functionality of ng-style is not compatible with min, and utilizing ng-model produces undesirable results

Why does the ng-style condition not work with min=0 if the saved value of ng-model="detail.Amount" is negative? <input type="number" min="0" oninput="validity.valid||(value='');" class="form-control" title="Amount" ng-model="detail.Amount" ng ...

Prevent a click event from triggering on one div when another div is clicked using jQuery

I am in the process of designing a website that includes two clickable divs, "#coloursettings" and "#powersettings". Both of these divs successfully unbind the menu ("#tab a"), but I am struggling to make them deactivate each other upon clicking one, then ...

When adding a new div, ensure it is counted and delete it once a new div is added

When clicked, a new div is added. When clicked again, another div with the same content is created as a duplicate. Q: Is there a way to remove the previous div when a new one is created? $(document).on('click', '.LibSectOpen', functio ...

What is the best way to establish a link between two containers?

Currently, my focus is on developing a unique component that poses a challenge with the connection between two containers. Specifically, I am working on crafting a sign-up form for users that comprises four distinctive sections. Each section triggers its o ...

I am struggling to extract data from the webpage using xpath

I'm currently delving into the realm of web scraping by working on various projects. One project involves creating a database of items from an online shoe store. However, I seem to be facing issues with extracting the data in text form. Here's w ...

Showing options in a menu to choose from

I'm currently working on implementing a dropdown menu for a news website. When the user selects '1' from the dropdown list, the page should display content corresponding to that selection. If the user selects '2', the page ...

What causes immediately invoked functions within event handlers to be executed before the event is triggered?

let b = (function maria() { alert("ee"); })(); * this code runs as soon as the page loads * <button onclick="b">Click me</button> * this code only runs when button is clicked * <button onclick="alert('ee')">Click m ...

Would it be considered semantically appropriate to have two <nav> elements included on a webpage, one for primary navigation and one for secondary navigation

I have a webpage that contains two sections with a "list of links". The first section is the main one: <nav> <ul> <li><a href="/">Homepage</a></li> <li><a href="/testimonies.html">Testimo ...

Setting a div to occupy the entire height of a webpage using HTML and CSS

Is there a way to make the div (the blue box) fill the entire page? I tried setting the body tag to height:100%, but it didn't work. You can view an example at http://jsfiddle.net/rVyrX/1/ ...

"Unusual bug in IE causing cell borders to disappear when colspan is used

Below is a sample table layout that I am working with: <table> <thead> <tr> <th>t1</th> <th>t2</th> <th>t3</th> <th>t4</th> ...

JavaScript code for opening and closing buttons

I created a button that successfully opens, but I am struggling to figure out how to close it. Can someone assist me with this? Additionally, I have one more query: How can I remove the border when the button is clicked? document.getElementById("arrowb ...

What is the best way to incorporate dynamic elements into a canvas that evolve over time?

Whenever a user interacts with my website by clicking on various parts, I want to display an expanding circle. My idea is to achieve this using a canvas element. Currently, I have successfully implemented the feature where a circle is drawn at the position ...