根据浏览器分辨率更改样式表定义 [英] Change Stylesheet definition based on browser resolution

查看:59
本文介绍了根据浏览器分辨率更改样式表定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个公司内部网上的门户网站。门户网站是

设计,记住1024 * 768的分辨率。我在所有文件中都包含了一个

..css文件。现在我必须使文件兼容

1024 * 768和800 * 600分辨率。我不想更改所有

文件以包含备用css。我可以在css文件中写一些javascript

条件来更改基于

分辨率的类定义。我不是Stylesheets的专家,并且没有找到任何

匹配谷歌搜索我的问题的讨论。


请帮忙。在此先感谢。

Techie

解决方案

techie写道:

大家好, .css文件。现在我必须使文件兼容
1024 * 768和800 * 600分辨率。我不想更改所有
文件以包含备用CSS。我可以在css文件中写一些javascript
条件来改变基于

的类定义

CSS文件不能包含javascript(尽管如此,它可能是使用

MSIE中的一些错误来模仿这样的功能)。我建议你重写CSS风格的

,以便网站可以很好地适应任何分辨率,但是你可能不太了解CSS。
/>

如果您确定javascript解决方案是可以的,那么你可以这样做,

然后继续使用文本编辑器,可以搜索/替换多个

文件。


如果没有看到HTML中的标记我会猜测标记会是什么?b $ b需要修复,所以你要'在任何情况下都需要修改每个文件。


请设置跟进.stylesheets或.javascript取决于

你要讨论哪个解决方案关于。


-

Mikko


如果你交叉发布 - - 我认为你不需要 - 至少设置

后续。 (设置为ciwas)


techie写道:


我有一个门户网站在公司内部工作。


因此这不是一个www问题,但确定。

门户网站的设计考虑到1024 * 768的分辨率。
我我在所有文件中都包含一个.css文件。现在我必须使
文件兼容1024 * 768和800 * 600分辨率。我不想改变所有文件以包含替代css。




< http://www.allmyfaqs.com/cgi-bin/ wiki.pl?AnySizeDesign >


-

Brian

按照我的地址中的说明发送电子邮件我


作为***** *****@yahoo.com (技术人员)写道:

我有一个门户网站为公司工作。该门户网站设计时考虑到1024 * 768的分辨率。我在所有文件中都包含了一个
.css文件。现在我必须使文件兼容
1024 * 768和800 * 600分辨率。


这就是为什么定位一个分辨率是一个坏主意。这是不灵活的。

两个不是更好。在某些时候,你的compagny会想要在他们的手机上访问

内联网,你再次参与其中。

我不想更改所有文件包括一个替代的CSS。


一个称职的搜索和替换程序应该可以轻松地做到这一点



我可以写一些javascript条件css文件要根据分辨率更改类定义。




编号样式表是静态的,没有脚本编写方法。


我建议您将样式表链接更改为Javascript文件,

并让该document.write正确的样式表链接。


因为您可以假设Javascript已启用,您可能会

甚至省略默认样式表。


/ L

-

Lasse Reichstein Nielsen - lr*@hotpop.com

Art D ''HTML:< URL:http://www.infimum.dk/HTML/randomArtSplit.html>

''没有判断的信仰只会降低精神神圣。''


Hi All,
I have a portal working on an intranet for a company. The portal was
designed keeping in mind the resolution of 1024*768. I am including a
..css file in all the files. Now i have to make the file compatible for
both 1024*768 and 800*600 resolutions. I don''t want to change all the
files to include an alternate css. Can i write some javascript
conditions in the css files to change the class definitions based on
resolutions. I am not an expert in Stylesheets and did not find any
matching discussions on google for my problem.

Please do help. Thanks in Advance.
Techie

解决方案

techie wrote:

Hi All,
I have a portal working on an intranet for a company. The portal was
designed keeping in mind the resolution of 1024*768. I am including a
.css file in all the files. Now i have to make the file compatible for
both 1024*768 and 800*600 resolutions. I don''t want to change all the
files to include an alternate css. Can i write some javascript
conditions in the css files to change the class definitions based on



CSS files cannot contain javascript (though, it might be possible to use
some bug in MSIE to emulate such feature). I''d suggest you to rewrite
the CSS style so that the site scales well for any resolution but you
probably don''t know CSS well enough.

IF you KNOW for sure that javascript solution is ok and you can do that,
then proceed with a text editor that can do search/replace for multiple
files.

Without seeing the markup in the HTML I''d guess that the markup would
need fixing anyway so you''d need to modify every file in any case.

Please, setup followups to either .stylesheets or .javascript depending
on which solution you want to discuss about.

--
Mikko


If you cross-post -- and I don''t think you needed to -- at least set
followups. (set to ciwas)

techie wrote:


I have a portal working on an intranet for a company.
Thus this is not a www question, but ok.
The portal was designed keeping in mind the resolution of 1024*768.
I am including a .css file in all the files. Now i have to make the
file compatible for both 1024*768 and 800*600 resolutions. I don''t
want to change all the files to include an alternate css.



< http://www.allmyfaqs.com/cgi-bin/wiki.pl?AnySizeDesign >

--
Brian
follow the directions in my address to email me


as**********@yahoo.com (techie) writes:

I have a portal working on an intranet for a company. The portal was
designed keeping in mind the resolution of 1024*768. I am including a
.css file in all the files. Now i have to make the file compatible for
both 1024*768 and 800*600 resolutions.
That is why targeting one resolution is a bad idea. It is inflexible.
Two isn''t better. At some point your compagny will want to access the
intranet on their cell phones, and you are at it again.
I don''t want to change all the files to include an alternate css.
A competent search and replace program should be able to do that
easily.
Can i write some javascript conditions in the css files to change
the class definitions based on resolutions.



No. Style sheets are static, and have no methods of scripting.

I suggest you change the style sheet link to a Javascript file,
and let that document.write the correct style sheet link.

Since you can probably assume that Javascript is enabled, you might
even omit a default style sheet.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D''HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
''Faith without judgement merely degrades the spirit divine.''


这篇关于根据浏览器分辨率更改样式表定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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