问题描述
我已经使用 Mamp 在我的 mac 上本地设置了 wordpress,但 css 文件不起作用。我可以正确获取 CSS 文件的链接,并且在 Chrome 和 Safari 中检查代码时,它会显示正确的 CSS 文件。但是无论我写什么类型的 CSS 代码,它都不会显示在我的页面上。
<html>
<head>
<Meta charset="utf-8"/>
<link rel=”stylesheet” href="<?PHP bloginfo('stylesheet_url'); ?>" type=”text/css” media=”screen” />
<title>My first website</title>
</head>
<body>
这是我要渲染的 CSS:
* {
margin: 0;
padding: 0;
}
#wrapper {
font-family: 'Trebuchet MS','Lucida Sans Unicode','Lucida Grande','Lucida Sans',Arial,sans-serif;
}
<html>
<head>
<Meta charset="utf-8"/>
<link rel=”stylesheet” href="http://localhost/firstsite/wp-content/themes/newtheme/style.css" type=”text/css” media=”screen” />
<title>My first website</title>
</head> ```
I can even click the CSS file from the inspected code and will then see the right file. What am I doing wrong here? PS. I have tried hard refresh of Chrome.
解决方法
解决方案是@gtamborero 建议的错误使用引号。谢谢你。现在浏览器正在完美地读取 CSS。