Articles of CSS

使用重写规则从url中删除.php后,css和img文件有404

我有我的网站和nginx服务器的问题…..从我的url地址删除.php我有错误的每个图像和CSS文件404。 有我的整个configuration文件: server { listen 80; server_name example.com; return 301 $scheme://www.example.com$request_uri; } server { listen 80; root /usr/share/nginx/www; index index.php; server_name www.example.com; error_page 404 http://www.example.com/404.php; autoindex off; error_log /usr/share/nginx/www/nginx_error.log warn; location / { rewrite ^(.*)$ /$1.php; } location = / { rewrite ^ /index.php; } location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; } } […]

Nginx重写问题

请求的每一页都被传递给“check.php”: rewrite ^/(.*)$ http://localhost/check.php?page=$1 “check.php”validation几个安全的东西,然后需要请求的页面: <?php // … security stuff require_once ($myRequestedPage); ?> 问题是,在HTML文件中,没有加载任何外部样式,只是脚本: <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!– Do not load –> <link href="css.css" rel="stylesheet" type="text/css" /> <!– Do not load –> <script src="js.js"></script> <!– Load –> <style> @import url("css.css"); <!– Do not load –> </style> <title></title> </head> <body></body> […]

在NGINX服务器上为Django启用CSS和JS文件的GZIP

xconfiguration文件/etc/nginx/ngnix.conf并没有发现任何问题。 仍然无法看到CSS和JavaScript的Gzip压缩。 我的NGINX.conf条目如下 – gzip on; gzip_disable "msie6"; gzip_comp_level 6; gzip_min_length 1100; gzip_buffers 16 8k; gzip_proxied any; gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss;

外部CSS文件没有加载链接标记

我正在与Angular开始一个新项目,并面临一个问题。 当我试图加载一个外部的CSS文件<link>它不起作用,但是当我使用@import的内部样式它工作! 不适用于: <link rel="stylesheet" type="text/css" src="transmission.min.css"> 适用于: <style>@import url('transmission.min.css');</style> 我的文件位于相同的目录(应用程序的根目录): / /index.html /transmission.min.css /transmission.min.js 我的CSS和JS文件连接,并与grunt缩小,但我没有它和相同的结果尝试。 这是我的index.html文件: <!doctype html> <html> <head> <title>Transmission</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" type="text/css" src="transmission.min.css"> <style> @import url('transmission.min.css'); </style> <base href="/"> </head> <body ng-app="transmission"> <div ng-view=""></div> <script src="transmission.min.js"></script> </body> 我的CSS文件只包含body{background-color: red;} 我检查了我的nginxconfiguration两次,一切似乎都很好。 我也检查了与Safari检查员,我可以访问http://transmission.dev/transmission.min.css的CSS文件。 但是它不会出现在资源选项卡中。 此外我的Angular应用程序加载完美。 如果你有什么想法? 😀 谢谢

无法在Nginx中投放CSS

我有一个/dist文件夹,它是在npm install后生成的(Angular)。 我把这个文件夹放在/usr/share/nginx/html/ 。 所以我使用Nginx来主持。 我的nginx.conf如下所示: events { worker_connections 1024; } http { upstream node-app { least_conn; server nodejs:8888 weight=10 max_fails=3 fail_timeout=30s; } server { listen 80; location / { alias /usr/share/nginx/html/dist/; index index.html; } location /api { proxy_pass http://node-app; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } } […]

Django React Nginx提供pipe理静态文件

我觉得有点尴尬,问一个已经回答的问题 – 但是我觉得有一个节点提供静态文件,而不是Django的点差。 由webpack捆绑和节点服务的CSS是没有问题,我遇到的问题是使用get_static_prefix修饰器服务了pipe理员的CSS和另外几个其他文件。 文件结构如下: root | public – templates – static | <– collectstatic adding files here – vendor | server – app1 – app2 | settings.py 在/ etc / nginx的/网站可用/项目 server { listen xxx.xxx.xxx.xxx:8000; server_name xxx.xxx.xxx.xxx; location /static { alias /root/se/env/public/static/; } } 和settings.py中的设置 STATIC_URL = '/root/se/env/public/static/' MEDIA_URL = '/media/' STATIC_ONLY_URL = '/static_only/' […]

CSS添加doctype时消失

当我添加一个DOCTYPE到我的网站,我的CSS无法加载。 当没有文档types时,它工作正常。 这是我的文档types: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 我的CSS位置在这里: www.site.com/static/css/main.css 像这样定义: <link href="/static/css/main.css" rel="stylesheet" type="text/css" /> 我做了一些谷歌search,但我的网站相当多的validation,所以我不明白为什么整个CSS会拒绝完全显示! 这是一个url: 现场 我正在使用最新的Google Chrome

样式表未被parsing,因为在严格模式下不允许使用非CSS CSStypes

我在我的网站上收到以下错误: [Error] Did not parse stylesheet at 'http://test.opendialogueapproach.co.uk/wp-content/plugins/revslider/public/assets/css/settings.css?ver=5.2.5.3' because non CSS MIME types are not allowed in strict mode. 做了一些研究似乎这可能与我的nginxconfiguration有关,但是我的nginx文件似乎与我在其他地方看到的有所不同,所以我不确定需要进行哪些更改才能解决问题。 我在下面包含了三个nginx文件: 首先是etc / nginx中的mime.conf文件,然后是nginx.conf,也是在etc / nginx中,最后是我的站点的conf文件在etc / nginx / conf.d中 mime.conf types { text/html html htm shtml; text/css css; text/xml xml rss; image/gif gif; image/jpeg jpeg jpg; application/x-javascript js; text/plain txt; text/x-component htc; text/mathml mml; […]

如何将CSS样式表应用于XULRunner中的所有页面视图

我试图开发一个显示设备(预计将安装在公共交通工具),它能够在Linux平台(我目前正在使用Archlinux )的无铬embedded式浏览器中显示(或多或less固定的)网页。 经过Mozilla Firefox的大量尝试之后,我现在将重点放在使用以下非常简单的xul文档的小型XULRunner应用程序上: <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="main" title="EPL Browser" width="1920" height="1080" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <browser type="content" src="http://www.example.org//" flex="1"/> </window> 这几乎和预期的一样,但现在我也想应用到这个页面(无论select哪个网页)一个CSS规则来删除不需要的滚动条,如下所示: body { overflow: hidden; } 当我使用Mozilla Firefox时 ,这非常简单,我只需要将它放在Firefoxconfiguration文件中的chrome / userContent.css文件中。 但是现在我想知道: 在我的xul文件中包含我的userContent.css文件是否有任何意义,以使其工作方式与Firefox相同? 如果没有,是否有另一种方法来应用这个相同的CSS规则(也可能是其他的)到我在xul “浏览器”标签中定义的页面? 例如,通过直接包含在xul文件中的一些其他标签? 任何帮助将受到欢迎。

Sass手表权限被拒绝 – 没有指南针

我试图在一个新的代码分支上运行sass watch命令。 当我运行正常的命令,我得到一个权限被拒绝的错误。 Errno::EACCES: Permission denied – /me/atg/workspace/AA/dev_3.4.0 这是我的命令: sass –watch stores.scss:/me/atg/workspace/AA/dev_3.4.0/a_a/modules/estore/j2ee/AA.war/static/css/stores.css –style compressed 我用sudo运行这个命令,它似乎运行。 手表会检测到scss文件中已经做了更改,但是刷新之后的更改不像以前使用watch命令那样显示。 我必须重build并启动服务器,以便实际显示在本地站点上的更改。 我认为这可能是caching问题,但不能确定。 我没有使用指南针,我读过的大多数解决scheme似乎都与指南针有关。 以下是不使用sudo运行watch命令时的跟踪。 from /usr/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir' from /usr/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p' from /usr/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each' from /usr/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p' from /usr/lib/ruby/1.9.1/fileutils.rb:205:in `each' from /usr/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p' from /var/lib/gems/1.9.1/gems/sass-3.4.16/lib/sass/plugin/compiler.rb:478:in `update_stylesheet' from /var/lib/gems/1.9.1/gems/sass-3.4.16/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets' from /var/lib/gems/1.9.1/gems/sass-3.4.16/lib/sass/plugin/compiler.rb:209:in `each' […]