简体   繁体   English

如何确保我的网站或基于HTML的网络应用程序能够在所有浏览器上正常运行

[英]How do I ensure my website or web app based on html works on all browsers properly

我想知道我是否需要在html文件中进行一种方式或设置,以便我的asp.net网站/ html网站在所有浏览器(IE / Firefox / Opera)中正确的长度/高度尺寸正常工作...等等......设置和我需要做的事情是什么?

Go to the Test Center at http://crossbrowsertesting.com/user and run live tests. 访问http://crossbrowsertesting.com/user上的测试中心并运行实时测试。 You'll have options for multiple browsers and versions. 您可以选择多个浏览器和版本。

There really isn't one way to check all browser compatibilities... 确实没有一种方法可以检查所有浏览器的兼容性......

The main problem with this is that each browser uses its own variation of the CSS3 standards. 这个问题的主要问题是每个浏览器都使用自己的CSS3标准变体。 Gecko and webkit browsers seem to be fairly consistent, but IE usually throws a wrench in the gears, especially between versions. Gecko和webkit浏览器似乎相当一致,但是IE通常会在齿轮中引起轰动,特别是在版本之间。

In all honesty, you are best making sure you comply with the standards and include browser engine specific styles to target each browser. 老实说,您最好确保符合标准并包含针对每个浏览器的浏览器引擎特定样式。

For instance, if you are setting the background and you wish to have a CSS styled gradient, you may need to do something like this: 例如,如果您要设置背景并希望拥有CSS样式渐变,则可能需要执行以下操作:

.gradient-bg {
    background: #ececed;
    background: -moz-linear-gradient(top,  #ececed 0%, #fefefe 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ececed), color-stop(100%,#fefefe));
    background: -webkit-linear-gradient(top,  #ececed 0%,#fefefe 100%);
    background: -o-linear-gradient(top,  #ececed 0%,#fefefe 100%);
    background: -ms-linear-gradient(top,  #ececed 0%,#fefefe 100%);
    background: linear-gradient(top,  #ececed 0%,#fefefe 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ececed', endColorstr='#fefefe',GradientType=0 );
}

This ensures that we address legacy browsers that don't support any gradient transformations, as well as various versions that do support but in different ways (ie -ms-linear-gradient vs. filer: progid:DXImageTransform.Microsoft.gradient or -webkit-gradient vs. -webkit-linear-gradient). 这确保我们解决不支持任何梯度转换的旧版浏览器,以及支持但以不同方式支持的各种版本(即-ms-linear-gradient与filer:progid:DXImageTransform.Microsoft.gradient或-webkit -gradient vs. -webkit-linear-gradient)。 Also note that any CSS attribute that is not recognized by the browser is simply ignored and the browser's rendering falls to the next recognized style variant. 另请注意,浏览器无法识别的任何CSS属性都会被忽略,浏览器的渲染属于下一个已识别的样式变体。

It is becoming more and more industry standard that you develop for CSS3 and let unorthodox browsers render unorthodoxically. 它为CSS3开发越来越多的行业标准,让非正统的浏览器呈现非正统的。

The only way to be truly sure is to check it in each supported browser and see for yourself. 真正确定的唯一方法是在每个支持的浏览器中检查它并亲自查看。 Also be aware, though, that while IE comes with developer tools that allow you to view your content rendered as if in previous versions of IE, it still may be drastically different from the actual (non-compatibility view) version. 另外请注意,虽然IE附带的开发人员工具允许您查看您在IE的早期版本中呈现的内容,但它仍然可能与实际(非兼容性视图)版本截然不同。

Easiest way to get IE to render the same (or close to it) across various version numbers is to force compatibility through a META tag. 使IE在各种版本号上呈现相同(或接近它)的最简单方法是通过META标记强制兼容。 ( renders in IE7 mode and supports DOCTYPE directive). (在IE7模式下呈现并支持DOCTYPE指令)。

Long story short... try to stick to standards to make webkit & gecko compatible, then address IE issues as you stumble upon them. 长话短说...尝试坚持标准,使webkit和gecko兼容,然后在发现它们时解决IE问题。 Since IE is about the only browser not in the other 2 categories, you should be good. 由于IE是唯一不属于其他两个类别的浏览器,因此您应该做得很好。

使用允许您在Adobe Browser Lab等多种浏览器中查看页面的服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何确保我有权访问我的网站的根页面? - How do I ensure I have authorization to the root page of my website? 在我的MVC网站中,我在哪里以及如何为不同的浏览器调用不同的CSS? - Where and how do i call different CSS for different browsers in my MVC website? 如何从另一个应用程序调用基于角色的授权Web API? - How do I call my role-based authorized web API from another app? 如何在没有 WWWROOT 的情况下使用 ASP.NET 在我的 Web 应用程序中提供 html 文件? - How do I serve an html file in my Web App with ASP.NET without the WWWROOT? 如何确保在.NET中正确处理对象? - How do I ensure that objects are disposed of properly in .NET? 如何确保在单个测试类中正确配置 asp.net web-api 服务中的所有控制器_? - How do I ensure that all controllers in an asp.net web-api service are configured correctly _in a single test class_? 在C#中,如何正确重载类中的Equals运算符,以便Queue.Contains()工作? - In C#, how do I overload the Equals operator in my class properly so that Queue.Contains() works? 如何解决我的 azure web 应用程序机器人上的 401? - How do I resolve a 401 on my azure web app bot? 如何确保操作不会使整个应用程序崩溃? - How do I ensure an operation won't crash the whole app? 如何确保正确加载了app.config? - How do I ensure that the right app.config is being loaded?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM