在我的CSS文件中,我有以下代码:
h1 {
color: black;
font-family: Calibri;
}
p {
color: black;
font-family: Calibri;
}
h2 {
color: black;
font-family: Calibri;
}
h3 {
color: black;
font-family: Calibri;
}
h4 {
color: black;
font-family: Calibri;
}
}
body {
color: black;
font-family: Calibri;
}
但是,我的HTML页面部分是Calibri和一些serif字体。 这是我的HTML页面的代码:
<!DOCTYPE html>
<html>
<link rel="stylesheet" type="text/css" href="file:///C:/Users/SreePC/Desktop/Website%20Setup/Website(1)/mystyle.css">
<body>
<h1>PC Parts</h1>
<p>This subpage will be all about PC Parts!</p>
<p> <a href=https://pcpartpicker.com/> Click here to make a PC build!</a></p>
<h2>CPU</h2>
CPU stands for Central Processing Unit. It performs the [blank] tasks for your computer. There are 2 main brands of CPU's. Intel and AMD. Intel is by far the most popular brand. It accounts for more than 90% of all CPU's used in the world. AMD is not very popular but it has the same quality as Intel. Due to its low market share, its prices are comparitevly cheaper than Intel CPU's. <br>If you are on a budget build, you should go with AMD. Also, if you want more cores for a low price you should go with AMD. If you can spend a bit more money, you should go with Intel. If you go with AMD, you should choose the Zen family as it is the newest version. If you go with Intel, you should go with 8th generation or Coffee Lake arcithecture. Multicore performence is completly revamped in 8th gen CPU's and is almost 60% faster than previous generations. When you look for a Intel CPU, you might see random letters on the end of the processor number. For a full cheat sheet to understanding this click <a href=file:///C:/Users/SreePC/Desktop/Website%20Setup/Website(1)/Subpages/PCparts/IntelNamingGuide.html> here</a>!
<br>
AMD: <br>
<b>Budget</b>: <a href=https://pcpartpicker.com/products/cpu/#s=62,60/> AMD Ryzen™ 3 or 5<br></body></a>
<b> The Best</b>:<a href=https://pcpartpicker.com/product/CF7CmG/amd-threadripper-1950x-34ghz-16-core-processor-yd195xa8aewof> AMD Ryzen™ Threadripper 1950x</a></p>
Intel: <br>
<b>Budget</b>: <a href=https://pcpartpicker.com/products/cpu/#s=11,12&f=85/> Intel Coffee Lake™ i3 or i5</a><br>
<b> The Best</b>: <a href=https://pcpartpicker.com/product/r87CmG/intel-core-i9-7960x-28ghz-16-core-processor-bx80673i97960x> Intel - Core i9-7960X (Extreme Edition)<br><a>
<h2>CPU Cooler</h2>
A CPU cooler keeps your CPU cool, or at low temperatures. You can determine what temperature your CPU is running by using a program called <b>Intel XTU</b> or Intel Extreme Tuning Utility. It can monitor your temperature, clock speed, and a whole lot more. Also, you can undervolt your CPU using this. Undervolting your CPU means reducing the power that goes to your CPU. It ca help decrease temperatures and stop thermal throttling. A great video that explains this is <a href=https://www.youtube.com/watch?v=QBNP5I2y668>here</a>. Now going back to subject, there are 2 main types of coolers, Air and Liquid. Air coolers use air to cool your CPU. Liquid uses water to cool your CPU. All coolers use a metal plate to transfer the heat from your CPU to the cooling system. The metal plate is attached on the metal part of the CPU. The heat gets transferred very efficently to the cool device. In a air cooler, the heat goes to a another metal part of the. The metal parts of the cooler are known as heat pipes, because the it transfers heat via "pipes". The pipes are cooled by air or water.
<br>
Air: <br>
<b>Budget</b>: CRYORIG - H7<br>
<b> The Best</b>: Noctua - NH-D15 82.5 CFM CPU Cooler<br>
<small> However, if this doesn't fit your case you should go with this: Noctua - NH-L9i</small>
<br>
<br>
Water: <br>
<b>Budget</b>: <a href=https://pcpartpicker.com/product/Vwdqqs/corsair-cpu-cooler-h60cw9060007ww> Corsair - H60<br></a>
<b> The Best</b>: Intel - Core i9-7960X (Extreme Edition)<br>
In <a href=https://www.youtube.com/watch?v=hr0qLLv3dKc>this video</a>, Linus Tech Tips puts a showdown between Air Cooling and Water Cooling. He is using a <a href=https://noctua.at/> Noctua</a> for air and (I think) Corsair for liquid.
<h2>Memory</h2>
<h2>Storage</h2>
<h2>Video Card</h2>
<h2>Case</h2>
<h2>PSU</h2>
<h2>Monitor</h2>
<h2>Keyboard</h2>
<h2>Mouse</h2>
<h2>Speakers</h2>
<h2>Thermal Compound</h2>
<h2>Other Stuff</h2>
</body>
<link rel="stylesheet" type="text/css" href="file:///C:/Users/SreePC/Desktop/Website%20Setup/Website(1)/mystyle.css">
</html>
&#13;
当我转到我的HTML页面时,只有标题和标题是Calibri。其他一切仍然是一些衬线字体。我想要一切都是Calibri,但我想在我的css文件上做。 你能告诉我我做错了吗?谢谢!
答案 0 :(得分:2)
您可以使用*来指定所有内容,但根据HTML的大小,这会降低页面呈现速度。
示例:
* {
font-family: Calibri;
color: black;
}
另一种选择是一次性指定所有元素,而不是重复它。
示例:
html,body,h1,h2,h3,p {
font-family: Calibri;
color: black;
}
您也可能遇到文本不在元素内部的问题,您可以使用可能有帮助的<span>
标记。
答案 1 :(得分:0)
也许尝试将文本包装在p标签中并使用以下css:
p {
color: black;
font-family: Calibri;
}
答案 2 :(得分:0)
您只需要:
body {
color: black;
font-family: Calibri;
}
其他“基础”风格无关紧要。正如评论中所提到的那样。您的现有CSS已被双}
打破。
您的文字中间还有一个结束</body>
标记。摆脱它。
body {
color: black;
font-family: Calibri;
}
<h1>PC Parts</h1>
<p>This subpage will be all about PC Parts!</p>
<p> <a href=https://pcpartpicker.com/> Click here to make a PC build!</a></p>
<h2>CPU</h2>
CPU stands for Central Processing Unit. It performs the [blank] tasks for your computer. There are 2 main brands of CPU's. Intel and AMD. Intel is by far the most popular brand. It accounts for more than 90% of all CPU's used in the world. AMD is not very popular but it has the same quality as Intel. Due to its low market share, its prices are comparitevly cheaper than Intel CPU's. <br>If you are on a budget build, you should go with AMD. Also, if you want more cores for a low price you should go with AMD. If you can spend a bit more money, you should go with Intel. If you go with AMD, you should choose the Zen family as it is the newest version. If you go with Intel, you should go with 8th generation or Coffee Lake arcithecture. Multicore performence is completly revamped in 8th gen CPU's and is almost 60% faster than previous generations. When you look for a Intel CPU, you might see random letters on the end of the processor number. For a full cheat sheet to understanding this click <a href=file:///C:/Users/SreePC/Desktop/Website%20Setup/Website(1)/Subpages/PCparts/IntelNamingGuide.html> here</a>!
<br>
AMD: <br>
<b>Budget</b>: <a href=https://pcpartpicker.com/products/cpu/#s=62,60/> AMD Ryzen™ 3 or 5<br>
<!-- What was this doing here?
</body>
-->
</a>
<b> The Best</b>:<a href=https://pcpartpicker.com/product/CF7CmG/amd-threadripper-1950x-34ghz-16-core-processor-yd195xa8aewof> AMD Ryzen™ Threadripper 1950x</a></p>
Intel: <br>
<b>Budget</b>: <a href=https://pcpartpicker.com/products/cpu/#s=11,12&f=85/> Intel Coffee Lake™ i3 or i5</a><br>
<b> The Best</b>: <a href=https://pcpartpicker.com/product/r87CmG/intel-core-i9-7960x-28ghz-16-core-processor-bx80673i97960x> Intel - Core i9-7960X (Extreme Edition)<br><a>
<h2>CPU Cooler</h2>
A CPU cooler keeps your CPU cool, or at low temperatures. You can determine what temperature your CPU is running by using a program called <b>Intel XTU</b> or Intel Extreme Tuning Utility. It can monitor your temperature, clock speed, and a whole lot more. Also, you can undervolt your CPU using this. Undervolting your CPU means reducing the power that goes to your CPU. It ca help decrease temperatures and stop thermal throttling. A great video that explains this is <a href=https://www.youtube.com/watch?v=QBNP5I2y668>here</a>. Now going back to subject, there are 2 main types of coolers, Air and Liquid. Air coolers use air to cool your CPU. Liquid uses water to cool your CPU. All coolers use a metal plate to transfer the heat from your CPU to the cooling system. The metal plate is attached on the metal part of the CPU. The heat gets transferred very efficently to the cool device. In a air cooler, the heat goes to a another metal part of the. The metal parts of the cooler are known as heat pipes, because the it transfers heat via "pipes". The pipes are cooled by air or water.
<br>
Air: <br>
<b>Budget</b>: CRYORIG - H7<br>
<b> The Best</b>: Noctua - NH-D15 82.5 CFM CPU Cooler<br>
<small> However, if this doesn't fit your case you should go with this: Noctua - NH-L9i</small>
<br>
<br>
Water: <br>
<b>Budget</b>: <a href=https://pcpartpicker.com/product/Vwdqqs/corsair-cpu-cooler-h60cw9060007ww> Corsair - H60<br></a>
<b> The Best</b>: Intel - Core i9-7960X (Extreme Edition)<br>
In <a href=https://www.youtube.com/watch?v=hr0qLLv3dKc>this video</a>, Linus Tech Tips puts a showdown between Air Cooling and Water Cooling. He is using a <a href=https://noctua.at/> Noctua</a> for air and (I think) Corsair for liquid.
<h2>Memory</h2>
<h2>Storage</h2>
<h2>Video Card</h2>
<h2>Case</h2>
<h2>PSU</h2>
<h2>Monitor</h2>
<h2>Keyboard</h2>
<h2>Mouse</h2>
<h2>Speakers</h2>
<h2>Thermal Compound</h2>
<h2>Other Stuff</h2>
附加说明:
你的HTML可以做很多整理。
避免使用文件引用。上传到服务器后,这些将不再有效。了解如何使用各种类型的相对和绝对路径。
最佳做法是将HTML属性括在引号中,例如:<a href="https://www.youtube.com/watch?v=QBNP5I2y668">
。单身或双人都很好,只是一致。
限制使用<br>
标记。它们在语义上毫无意义,你无法对它们进行设计。切勿将它们用于垂直间距,请根据需要使用填充或边距。