我陷入了一个问题。这些天我正在学习 HTML CSS,并且正在练习基本布局。
HTML
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="C:\Users\Karan-Mehul\Desktop\asssi.css" />
<title>Assignment 1</title>
</head>
<body>
<div id="wrapper">
<header>
<h1> My First Website </h1>
</header>
<p>Welcome to my website! Here are a few things I enjoy Favourite Quotes Here is another favourite quote of mine Favourite Quotes Here is another favourite quote of mine And another And another</p>
<ul>
<li>Web Dev</li>
<li>Chess</li>
<li>Reading</li>
<li>Learning</li>
</ul>
<ol>
<li>Web Dev</li>
<li>Chess</li>
<li>Reading</li>
<li>Learning</li>
</ol>
<div id="try">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever ly with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
<footer>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever ly with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</footer>
</div>
</body>
</html>
CSS
body {
font-family: sans-serif;
}
p {
background-color: red;
float: left;
width: 330px;
margin: 0px;
padding-top: 20px;
line-height: 37px;
}
ul {
background-color: green;
width: 250px;
float: right;
margin: 0px;
margin-left: 50px;
}
#wrapper {
width: 1000px;
margin: auto;
background-color: blue;
}
li {
list-style: none;
padding: 5px;
}
header {
text-align: center;
}
ol {
background-color: brown;
width: 250px;
float: right;
margin: 0px;
}
#try {
background-color: #005157;
margin-top: 160px;
margin-left: -30px;
width: 500px;
float: left;
}
footer {
width: 700px;
background-color: green;
}
我的问题是我无法在div id="try"
和<footer>
为什么会这样?为什么我默认会变成红色?我没有指定任何样式。此外,包装器的样式为 background-color:blue 所以即使颜色必须是蓝色的,不是吗?