如何解决C#,asp.net中的浏览器浏览器兼容性? [英] How to solver browser compatibility in C#, asp.net ?

查看:367
本文介绍了如何解决C#,asp.net中的浏览器浏览器兼容性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在asp.net上工作,我需要知道如何解决浏览器兼容性,这意味着当我将在Internet Explorer中运行asp.net应用程序时,它将显示正确的对齐页面,但是当我将在Mozilla firebox或Opera中运行相同的应用程序时,谷歌浏览器,它将无法以正确的格式显示.为什么会这样发生以及如何解决这个问题.请帮我.提前谢谢.

谢谢
PBN

Hi All,

I am working on asp.net I need to know how to solve browser compatibility, it means when I will run asp.net application in internet explorer it will show correct aligned pages, but when I will run same application in Mozilla firebox or opera or google chrome it will not show in proper format. Why it is happening like this and how to solve this. Please help me. Thanks in advance.

Thanks
PBN

推荐答案

使其看起来100%相同几乎是不可能的.这只是自然而然的事实:不同的布局引擎之间存在巨大差异,而支持标准的准确性却受到限制.但是您可以通过进行一些更改来最大程度地减少浏览器之间的差异.看看:

1.除非有必要,否则不要以px为单位指定高度或宽度.
2.永远不要给出<table cellpadding="2" ...,而是应用来自CSS的填充类.
3.如果您在客户端功能中的某个地方写了document.getElementById,并且您将<as:Scriptmanager与u一起使用,请使用
Making it looking 100% identical is nearly impossible. This is just a fact of nature: considerable differences in different layout engines and limited accuracy in support of the standards. But you can minimize the differences in browsers by making some sort of changes. Have a look:

1. Never give height or width in px..unless it is necessary.
2. Never give <table cellpadding="2" ... instead apply padding class from Css.
3. If u are writtnig document.getElementById somewhere in ur Client side fucntion and if u have the <as:Scriptmanager with u then use


get. ..
即代替document.getElementById("objID");编写
get...
i.e instead of document.getElementById("objID"); write


get("objID");//为
get("objID"); //as


这篇关于如何解决C#,asp.net中的浏览器浏览器兼容性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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