Rails:Css在开发和生产上似乎有所不同 [英] Rails: Css appears to be different in dev and production

查看:64
本文介绍了Rails:Css在开发和生产上似乎有所不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标准的rails 4/heroku设置.一件事很奇怪:页面的不同元素在本地环境和生产环境中以不同的大小显示.

i have a standard rails 4/heroku setup. One thing is weird: The different elements of the page appear in different sizes for the local environment and for the production environment.

例如:尽管标头高度设置为特定的像素值,但两种环境的高度不同. 与内容的宽度相同:我将最大宽度设置为1260px-两种环境下内容的宽度都不同.

For example: Although the header-height is set to a specific pixel value it is different in height for the two environments. Same with the width of the content: I set a max-width of 1260px - the width of the content is different for the two environments.

一切似乎都在生产中更大.

Everything appears bigger in production.

我发现了一个相关的问题,这表明问题是由于资产被两次编译所致.那不是我的问题... 我的CSS开发和生产环境之间的加载方式有所不同

I found one related question, suggesting that the problem is due to assets which are compiled twice. Thats not the problem in my case...My CSS is loading differently between development and production environments

这种行为的原因是什么?预先感谢.

Whats the reason for this behaviour? Thanks in advance.

推荐答案

好,我现在解决了.它令人尴尬,但也许对其他人有所帮助:我无意间为localhost激活了浏览器缩放功能.我从一开始就没有提出这个建议的原因是,搜索框和其他元素也以不同的样式出现-甚至没有任何样式!没有浏览器缩放的搜索框在chrome中有圆角.浏览器缩放为-1时,搜索框显示为矩形.这就是为什么我认为仍然应用样式的原因,即使我禁用了所有样式表 facepalm .

Ok, i solved it now. Its embarrassing, but maybe it helps someone else: I activated the browser zoom for localhost unintentionally. The reason why i didn't come up with this from the beginning was, that also search boxes and other elements appeared in a different style - even without any styles! Search boxes without browser zoom have rounded corners in chrome. With browser zoom of -1, search boxes appear rectangular. This is why i thought there are still styles applied, even i disabled all my stylesheets facepalm.

也许其他人可以通过此提示节省一些时间.

Maybe someone else can save some time with this hint.

这篇关于Rails:Css在开发和生产上似乎有所不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆