如何在CSS中执行IE条件? [英] How do I do IE conditionals in CSS?

查看:144
本文介绍了如何在CSS中执行IE条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想根据浏览器添加填充,用户正在查看的页面,是否有一种方法在CSS中,我可以做类似:

If I want to add padding based on the browser the user is viewing the page in, is there a way in CSS that I can do something like:

if IE do
padding:5px;
else if不是IE do
padding 10px;

if IE do padding:5px; else if not IE do padding 10px;

推荐答案

这里是一个很好的参考: Quirksmode.org条件注释

Here is a great reference: Quirksmode.org Conditional Comments.

虽然控制结构是在标记而不是CSS,它实现您的目标,通常被认为是最佳实践,当服务浏览器特定的样式表。

Although the control structure is in the markup and not the CSS, it accomplishes your goal and is usually considered the best practice when serving browser-specific stylesheets.

这篇关于如何在CSS中执行IE条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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