问题描述
使网页在当今所有主要浏览器中都能正确显示是一项非常耗时的任务.
Making a web page display correctly im all major browsers today is a very time consuming task.
是否有一种简单的方法可以使 CSS 样式在每个浏览器中看起来都相同?或者至少您有一些提示可以让这项工作更轻松吗?
Is there a easy way to make a CSS style that looks identical in every browser?Or at least do you have some tips to make this work easier?
推荐答案
我同意所有重置"建议和网格"框架建议,但我确实想补充一点建议:在每个浏览器中都相同实际上是无法实现的,因为您无法控制客户端.举个例子:字体.
I agree with all the "reset" suggestions and the "grid" framework suggestions, but I did want to add a bit of advice: The goal of identical in every browser is, in practical terms, unachievable because you cannot control the client. Case in point: fonts.
您在 CSS 中声明您的字体样式,但某些 Linux 机器、某些 Mac、某些移动浏览器——将没有您指定的字体.这种变化会导致不同的文本长度和换行.然后是浏览器版本和运行的操作系统的差异;不同浏览器如何实现缩放功能;并且最终用户可以调整文本大小.完全相同的渲染只是一个无法实现的目标.
You declare your font styles in CSS but some Linux machines, some Macs, some mobile browsers -- will not have the font you specified. This variation leads to differing text lengths and wrapping. Then there's the variance of browser versions and operating systems running each; how different browsers implement zoom features; and the text size can be adjusted by the end user. Identical rendering is simply an unachievable goal.
但是放心!这是 CSS 的艺术"部分:能够在您的设计中灵活处理,从而优雅地处理浏览器、操作系统和最终用户调整之间的差异.不要追求完全相同的渲染——您应该追求品牌一致性 + 适当的体验 + 灵活性.
But take heart! This is the "art" part of CSS: Being able to be flexible in your design such that variances between browsers, operating systems, and end-user adjustments are handled elegantly. Don't strive for identical rendering -- you should strive for brand consistency + appropriate experience + flexibility.
这篇关于使 CSS 在所有浏览器中呈现相同的最简单或最快的方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!