【发布时间】:2017-10-18 17:47:00
【问题描述】:
我正在为学校做这项作业,我需要将标语和小图片背后的背景放在一边,以便完美地包围文字。但是,我无法让宽度标签工作。请帮我找到这个问题的根源。很抱歉格式不好。我有点时间紧迫。
<!DOCTYPE html>
<html>
<head>
<title>MNSportsInc</title>
</head>
<center><p><font size="8">Minnesota Sports Inc.</font></p></center>
<style>
h1 {color: white; background: black; font-family: times; font-size:
120%; width: 300}
h2 {color: white; background: black; font-family: times; font-size:
120%; width: 500}
h3 {color: white; background: black; font-family: times; font-size:
120%; width: 500}
h4 {color: white; background: black; font-family: times; font-size:
120%; width: 500}
h5 {color: white; background: black; font-family: times; font-size:
120%; width: 500}
h6 {color: white; background: black; font-family: times; font-size:
120%; width: 500}
</style>
<body>
<center>
<h1><a href="https://www.mlb.com/twins"><img src="Twins.gif"></a>Twins
get wins!<a href="https://www.mlb.com/twins"><img src="Twins.gif"></a></h1>
<!--Twins-->
<h2><a href="https://www.nhl.com/wild"><img src="Wild.png"></a>Crack a
smile for the Wild.<a href="https://www.nhl.com/wild"><img src="Wild.png">
</a></h2><!--Wild-->
<h3><a href="http://www.vikings.com/"><img src="Vikings.png"></a>Buy
things for the Vikings.<a href="http://www.vikings.com/"><img
src="Vikings.png"></a></h3><!--Vikings-->
<h4><a href="http://www.nba.com/timberwolves/"><img src="Wolves.jpg">
</a>Fans pull the Wolves!<a href="http://www.nba.com/timberwolves/"><img
src="Wolves.jpg"></a></h4><!--Timberwolves-->
<h5><a href="http://www.gophersports.com/"><img src="UofM.png"></a>Beat
the Gophers? No sir!<a href="http://www.gophersports.com/"><img
src="UofM.png"></a></h5><!--UofM-->
<h6><a href="http://crimson-activities.com/"><img src="Crimson.jpg">
</a>The Crimson have Risen.<a href="http://crimson-activities.com/"><img
src="Crimson.jpg"></a></h6><!--Crimson-->
</center>
</body>
</html>
【问题讨论】:
-
看起来您需要提供您想使用的度量单位,例如 px、em、pt、%、in、cm、mm 等。
-
请注意,您的学校从 20 年前开始教您 HTML...
-
您正在尝试在
标签上应用宽度... 标签没有宽度属性.. 请阅读w3schools.com -
增加
标签的字体大小..