**已关闭。**此问题为not reproducible or was caused by typos。当前不接受答案。
这个问题是由打字错误或无法再重现的问题引起的。虽然类似的问题在这里可能是on-topic,但这个问题的解决方式不太可能帮助未来的读者。
昨天关门了。
Improve this question
我已经将外部CSS链接到html,但是当我在浏览器中运行html代码时,我在CSS文档中指定的规则没有被应用。我还可以做些什么来使css代码运行?
我调试了html代码中的外部css链接,并添加了一个utf-8字符集属性到我的外部css中,但是当我运行html代码时,我在外部css中指定的规则仍然没有被应用。
@charset "utf-8";
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;700&display=swap');
body {
font-family: 'Open Sans', sans-serif;
font-size: 20px;
}
h1 {
font-size: 150%;
}
h2 {
font-size: 1.2em;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>My Trip Around the USA on a Segway</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;700&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="journal.css">
</head>
<body>
<h1>Segway’n USA</h1>
<p>Documenting my trip around the US on my very own Segway!</p>
<h2>June 2, 2012</h2>
<img src="images/segway1.jpg" />
<p>My first day of the trip! I can’t believe I finally got everything packed and ready to go. Because I’m on a Segway, I wasn’t able to bring a whole lot with me:
<ul>
<li>cell phone</li>
<li>iPod</li>
<li>digital camera</li>
<li>protein bar.</li>
</ul>
Just the essentials. As Lao Tzu would have said, <q>A journey of a thousand miles begins
with one step Segway.</q></p>
<h2>July 14, 2012</h2>
<p>I saw some Burma Shave style signs on the side of the road today:
</p>
<p>
<blockquote>
Passing cars,<br /> When you can’t see,<br /> May get you,<br /> A glimpse,<br /> Of eternity.<br />
</blockquote>
</p>
<p>
I definitely won’t be passing any cars.</p>
<h2>August 20, 2012</h2>
<img src="images/segway2.jpg" />
<p>Well I made it 1200 miles already, and I passed through some interesting places on the way:S
</p>
<ol>
<li>Walla Walla, WA</li>
<li>Magic City, ID</li>
<li>Bountiful, UT</li>
<li>Last Chance, CO</li>
<li>Truth or Consequences, NM</li>
<li>Why, AZ</li>
</ol>
</body>
</html>
2条答案
按热度按时间4xrmg8kj1#
您在同一行中指定了两次字体系列,即
font-family: font-family:
edqdpe6u2#
你的树目录是如何建立的?也许问题出在路径上(你添加css文件的html中的src属性)