gpt4 book ai didi

html - 未应用外部 CSS,但粘贴为内部时相同的代码有效

转载 作者:太空宇宙 更新时间:2023-11-04 11:55:56 25 4
gpt4 key购买 nike

我是一名新手,正在通过在线教程学习 html/css 的方法。直到现在,我遇到了一个我不太清楚的小问题,并且我已经尝试过从这个网站和更多网站上对类似问题的建议。

正如标题所说,我的外部 css 文件似乎根本不起作用,尽管如果我在内部应用它,上述代码工作正常。我一直在重新阅读代码,试图找出错误,但即使是 css lint 和 codepen 似乎也只是说我有过多的元素,除此之外没有太多。我试过只使用类名,例如.Attack 而不是 td.Attack,但这没有帮助。

html 基本上是一个包含一些图像的表格,我只是想应用一个样式表。这里是 tcgdatabase.css

body {
background-color:transparent;
}

p {
color:#2E2435;
text-align:justify;
}

td {
text-align:left;
}
td.Name {
text-align:left;
width:250px;
font-size:30px;
font-weight:bold;
}
td.Type {
width:50px;
}
td.Stage {
text-align:left;
width:120px;
font-size:15px;
font-weight:bold;
}
td.HP,td.AP {
width:50px;
font-style:italic;
font-size:30px;
}
span.Points {
font-size:15px;
}
td.Attack,td.BaseDamage {
height:30px;
font-weight:bold;
font-size:20px;
}
td.Effect,td.Flavour {
text-align:justify;
}
td.WRR,td.WRRType {
height:20px;
font-weight:bold;
}
th {
text-align:center;
}

这是 html 页面,我什至将 css 放在里面,以显示我是如何在内部添加它的:

<!DOCTYPE html>
<html lang="en-GB">
<head>
<title>oddities</title>
<meta charset="UTF-8">
<link ref="stylesheet" type="text/css" href="file:///C:/Users/Admin/Documents/TCG/JBSet1/tcgdatabase.css">
<!--<style>
body {
background-color:transparent;
}

p {
color:#2E2435;
text-align:justify;
}

td {
text-align:left;
}
td.Name {
text-align:left;
width:250px;
font-size:30px;
font-weight:bold;
}
td.Type {
width:50px;
}
td.Stage {
text-align:left;
width:120px;
font-size:15px;
font-weight:bold;
}
td.HP,td.AP {
width:50px;
font-style:italic;
font-size:30px;
}
span.Points {
font-size:15px;
}
td.Attack,td.Base Damage {
height:30px;
font-weight:bold;
font-size:20px;
}
td.Effect,td.Flavour {
text-align:justify;
}
td.WRR,td.WRRType {
height:20px;
font-weight:bold;
}
th {
text-align:center;
}
</style>-->
</head>
<body>
<table style="width:100%">
<tr>
<td rowspan="9" style="width:420px"><img src="CacturneR.png" style="width:350px"></td>
<td class="Type"><img src="Energy Types/Dark.png" style="width:40px"></td>
<td class="Stage">Legendary</td>
<td class="Name">Yveltal</td>
<td class="HP">110<span class="Points">HP</span></td>
<td class="AP">0<span class="Points">AP</span></td>
</tr>
<tr>
<td class"AttackCost" colspan="2">
<img src="Energy Types/Dark.png" style="width:30px">
<img src="Energy Types/Colourless.png" style="width:30px">
</td>
<td class="Attack" colspan="2">Take In</td>
<td class="BaseDamage"><td>
</tr>
<tr>
<td class="Effect" colspan="5">
Attach up to 3 Pokémon from your hand to this Pokémon and heal 10 damage from this
Pokémon times the number of Pokémon cards just attached in this way. Each Pokémon attached
in this way provides 1 Energy of their type at a time (If they have more than 1 type,
they provide Energy of each of their types, but only 1 at a time).
</td>
</tr>
<tr>
<td class"AttackCost" colspan="2">
<img src="Energy Types/Dark.png" style="width:30px">
<img src="Energy Types/Dark.png" style="width:30px">
<img src="Energy Types/Colourless.png" style="width:30px">
<img src="Energy Types/Colourless.png" style="width:30px">
</td>
<td class="Attack" colspan="2">Riot Ballista</td>
<td class="BaseDamage"><td>
</tr>
<tr>
<td class="Effect" colspan="5">
Discard 1 card attached to this Pokémon. If that card is a Pokémon, this
attack does damage equal to the discarded Pokémon's HP. If it is not a
Pokémon, this attack does 50 damage and this Pokémon does 50 damage to
itself.
</td>
</tr>
<tr>

<td class="WRRType"><img src="Energy Types/Fairy.png" style="width:25px"></td>
<td class="WRR">weakness: x2</td>
<td class="Flavour" colspan="3" rowspan="3">
"This terrible beast has long since turned a blind eye to the havoc it
wreaks in its wake" - Anon.
</td>
<tr>
<td class="WRRType"><img src="Energy Types/Fighting.png" style="width:25px"></td>
<td class="WRR">resistance: -20</td>
</tr>
<tr>
<td class="WRRType"><img src="Energy Types/colourless.png" style="width:25px"></td>
<td class="WRR">retreat cost: x2</td>
</tr>
<tr>
<td class="Illus" colspan="3">Illus. NavaskaIII</td>
<td class="SetNumber">??/??</td>
<td class="Rarity">UR</td>
</tr>
</table>
</body>
</html>

我觉得我遗漏了一些非常明显的东西,非常感谢您的帮助!

最佳答案

在您的链接元素中更改 ref="样式表"到 rel="样式表"

注意'f'应该是'l'

关于html - 未应用外部 CSS,但粘贴为内部时相同的代码有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30246725/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com