在浏览器中样式表不起作用,CSS文件无法加载其中····· 显示出来只有111这些数字的
<head><metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/><title>19sulia...
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>19sulian</title>
<link rel="stylesheet" href="/css/layout.css" type="text/css">
</head>
<body>
<div id="container">
<div id="container2">
<div id="header">111</div>
<div id="mainNav">111</div>
<div id="sidebar">111</div>
<div id="content">111</div>
<div id="footer">222</div>
</div>
</div>
</body>
html,body{
margin:0;
border:0;
text-align:center;
}
#container{
position:relative;
width:982px;
margin:0 auto;
background-color:#F00;
text-align:left;
}
#header{
height:78px;
background-image:url(../images/main-nav.jpg);
background-repeat:no-repeat;
}
#mainNav{
height:33px;
background-image:url(../images/header.gif);
background-repeat:no-repeat;
}
我试啦,不是这个吧,还是一样没效果····· 展开
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>19sulian</title>
<link rel="stylesheet" href="/css/layout.css" type="text/css">
</head>
<body>
<div id="container">
<div id="container2">
<div id="header">111</div>
<div id="mainNav">111</div>
<div id="sidebar">111</div>
<div id="content">111</div>
<div id="footer">222</div>
</div>
</div>
</body>
html,body{
margin:0;
border:0;
text-align:center;
}
#container{
position:relative;
width:982px;
margin:0 auto;
background-color:#F00;
text-align:left;
}
#header{
height:78px;
background-image:url(../images/main-nav.jpg);
background-repeat:no-repeat;
}
#mainNav{
height:33px;
background-image:url(../images/header.gif);
background-repeat:no-repeat;
}
我试啦,不是这个吧,还是一样没效果····· 展开
2个回答
展开全部
样式导入的路径不对吧。
<link rel="stylesheet" href="/css/layout.css" type="text/css">
改成
<link rel="stylesheet" href="../css/layout.css" type="text/css">
少了两点
<link rel="stylesheet" href="/css/layout.css" type="text/css">
改成
<link rel="stylesheet" href="../css/layout.css" type="text/css">
少了两点
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
CSS的样式要写在HEAD里,用<style></style>标签包含
这样:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>19sulian</title>
<link rel="stylesheet" href="/css/layout.css" type="text/css">
<style>
html,body{
margin:0;
border:0;
text-align:center;
}
#container{
position:relative;
width:982px;
margin:0 auto;
background-color:#F00;
text-align:left;
}
#header{
height:78px;
background-image:url(../images/main-nav.jpg);
background-repeat:no-repeat;
}
#mainNav{
height:33px;
background-image:url(../images/header.gif);
background-repeat:no-repeat;
}
</style>
</head>
<body>
<div id="container">
<div id="container2">
<div id="header">111</div>
<div id="mainNav">111</div>
<div id="sidebar">111</div>
<div id="content">111</div>
<div id="footer">222</div>
</div>
</div>
</body>
这样:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>19sulian</title>
<link rel="stylesheet" href="/css/layout.css" type="text/css">
<style>
html,body{
margin:0;
border:0;
text-align:center;
}
#container{
position:relative;
width:982px;
margin:0 auto;
background-color:#F00;
text-align:left;
}
#header{
height:78px;
background-image:url(../images/main-nav.jpg);
background-repeat:no-repeat;
}
#mainNav{
height:33px;
background-image:url(../images/header.gif);
background-repeat:no-repeat;
}
</style>
</head>
<body>
<div id="container">
<div id="container2">
<div id="header">111</div>
<div id="mainNav">111</div>
<div id="sidebar">111</div>
<div id="content">111</div>
<div id="footer">222</div>
</div>
</div>
</body>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询