【发布时间】:2016-07-25 18:46:57
【问题描述】:
当我在 Firefox 中打开我的页面时,没有应用 Css。但是它确实可以在 google chrome 中使用。以下是详细信息:
HTML:
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<link type="text/css" href="Style.css" rel="stylesheet">
</head>
<body>
<div id="content">
<p>
Lorem ipsum dolor sit amet, dolorem fierent vim ea. Duo no discere
voluptatum. Eum eu adhuc appareat, dolores imperdiet sea ea. Pri ut
cetero consectetuer, ad populo sensibus ius. Nominavi persecuti pro ad,
bonorum imperdiet moderatius cu cum, tollit tritani numquam ex qui.
</p>
</div>
</body>
</html>
外部 CSS:Style.css
#content{
width:300px;
height:500px;
background:#e3e3e3;
border:1px solid #666;
margin-top:40px
}
#content p{
padding:20px;
}
【问题讨论】:
-
似乎在 Firefox 中运行良好。这是一支笔codepen.io/anon/pen/JKvwdb 有什么特别的东西不工作吗?
-
</link>无效。您似乎将 CSS 元素包含在<link></link>中,这是错误的。像这样的内部 CSS 应该包含在<style></style>标记中。 -
您的 HTML 无效。无效的 html 在不同的浏览器中可能有随机行为。修复您的链接和样式标签。您不需要内部 css 的外部链接元素。它需要包含在样式标签中。
-
这是一个令人费解且令人困惑的问题。您如何提供指向实际示例的链接或添加代码片段。
-
它在 Firefox 中就像一个魅力:jsfiddle.net/cne4c7gk Style.css 与 html 文件在同一个文件夹中?
标签: html css google-chrome firefox web-frontend