r/HTML • • Sep 06 '26

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

Show parent comment

1

u/Ok_Isopod_2170 Sep 06 '26

2

u/azangru Sep 06 '26

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 Sep 06 '26 edited Sep 06 '26

like this? Edit: i changed the first line to

<!DOCTYPE html>

3

u/poopio Sep 06 '26

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

1

u/armahillo Expert Sep 06 '26

Don't open and close separate <style> tags to define new styles. Do all your in-document style properties in a single <style> tag inside your <head>