刚刚开始一个新的 HTML 元素并边学边做,但我似乎无法弄清楚为什么我的代码没有链接起来。我试图让我的图片占屏幕的 100% 宽度,但我意识到我的代码没有对齐。
有什么建议吗?
这是我的 HTML:
<!DOCTYPE html>
<html>
<head>
<title>liz project</title>
<LINK rel="stylesheet" type="text/css" href="stylesheet.css" media="screen">
</head>
<body>
<h1>my first project</h1>
<p> welcome to the best site on the planet woohoo <br>
<img class="bg" src="http://blissmakedesign.com/wp-content/uploads/2012/11/livingroom1.jpg"> </p>
这是我的 CSS:
h1 {font-family: arial; color: red }
.bg {width: 100%; margin-right: auto; margin-left: auto }
super 基础,刚刚开始。非常感谢!
最佳答案
我建议您了解如何使用文件路径。
quick reminder about file path
- 以“/”开头返回根目录并从那里开始
- 以“../”开始向后移动一个目录并从那里开始
- 以“../../”开头向后移动两个目录并开始 那里(等等……)
- 要继续前进,只需从第一个子目录开始并保持 前进
因此,请确保您的文件路径方向正确。
关于css - 基本 HTML : External Stylesheet not linking,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25738127/