英文:
Problem with CSS style sheet functionaltiy
问题
我在VS Code中创建一个HTML页面,并尝试为一个div元素添加样式,但是我的CSS样式表中的设置似乎都不起作用。
我已经确认我的HTML文件正在引用CSS文件,并且通过W3C CSS验证器运行了CSS代码。
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="/Untitled/csss/style.css">
<title>License Manager</title>
</head>
<body>
<div class="login">
<textarea rows="1" cols="20">
password
</textarea>
<button>
Authenticate
</button>
</div>
</body>
</html>
CSS
body {
background-color: gray;
}
.login {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
border-width: 10px;
border-color: black;
}
英文:
I'm creating an HTML page in VS Code and trying to style a div, however none of the settings in my CSS stylesheet seem to be working.
I have confirmed my HTML is referencing the CSS file and ran the CSS code through the W3C CSS validator.
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="sytlesheet" type="text/css" href="/Untitled/csss/style.css">
<title>License Managert</title>
</head>
<body>
<div class="login">
<textarea rows="1" cols="20">
password
</textarea>
<button>
Authenticate
</button>
</div>
</body>
</html>
CSS
body{
background-color: gray;
}
.login{
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
border-width: 10px;
border-color: black;
}
答案1
得分: 0
更改:
<link rel="sytlesheet" type="text/css" href="/Untitled/csss/style.css">
为:
<link rel="stylesheet" type="text/css" href="/Untitled/csss/style.css">
你拼错了 "stylesheet"。
英文:
Change:
<link rel="sytlesheet" type="text/css" href="/Untitled/csss/style.css">
to:
<link rel="stylesheet" type="text/css" href="/Untitled/csss/style.css">
you have stylesheet misspelled.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论