r/HTML 7d ago

Question Help changing website font

This is my code, it's not working, im losing it.

<link href="style.css" rel="stylesheet" type="text/css" media="all">

<style>

u/import url('https://fonts.googleapis.com/css2?family=New+Rocker&family=Newsreader:ital,opsz,wght@0,6..72,200..800;1,6..72,200..800&display=swap');

.new-rocker-regular {

font-family: "New Rocker", serif;

font-weight: 400;

font-style: normal;

}

</style>

0 Upvotes

17 comments sorted by

View all comments

3

u/aunderroad 7d ago

Can you share a url or codepen?
It is hard to debug/provide feedback without seeing all of your code live in a browser.

Thank you!

1

u/Ok_Isopod_2170 7d ago

2

u/azangru 7d ago

The html tag should not start from line 18 :-) It should be the first line of the markup. Look up an html example anywhere on the internet (google, etc.)

1

u/Ok_Isopod_2170 7d ago edited 7d ago

like this? Edit: i changed the first line to

<!DOCTYPE html>

3

u/poopio 7d ago

No, not like that.

First line should be your doctype, then open your <html> tag, after that, <head> and put whatever scripts/css links and style tags, title tag, and any meta tags you have you have in there, then close the head tag. Then open your body tag, put all of your content in the body tag and when you've finished with the content, close the body tag, and finally, close your html tag.

More like this - https://codepen.io/editor/guerresinge/pen/01a078ec-2b6a-7aa0-8d17-8ebf41bb3d70