向Web控件添加样式-3种方法只能做到一种? (Internet Explorer 7) [英] Adding style to a web control - 3 ways to do it only one works?! (Internet Explorer 7)

查看:134
本文介绍了向Web控件添加样式-3种方法只能做到一种? (Internet Explorer 7)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个linkBut​​ton,我尝试向其中添加CSS,因此它不会包装放在其后的控件.我尝试了三种添加样式的方法:

I have a linkButton that I try to add CSS to so it does not wrap the control placed after. I have tried three different ways to add a style:

myLinkButton.Attributes.Add("style", "white-space: nowrap; display: inline;");
myLinkButton.Attributes.Add("class", "inline");
myLinkButton.CssClass = "inline";


我的CSS文件如下所示:


My CSS file looks like this:

.inline
{
white-space: nowrap; 
display: inline;
}


只有第一个示例实际上可以完成应有的操作;在linkBut​​ton之后不创建换行符.其他两个没有.为什么?对我而言,这没有任何意义. CSS文件中提供的CSS可以工作,因为当我添加背景色只是为了检查它是否实际起作用时,该对象将获得背景色.

这与Internet Explorer 7(7.0.5730.13 ).


Only the FIRST example actually does what it is supposed to do; not creating a line break after the linkButton. The other two does NOTHING. Why? To me it makes no sense. The CSS provided in the CSS file works, because when I add a background color just to check that it actually works, the object gets the background color.

This is related to Internet Explorer 7 (7.0.5730.13).

推荐答案

Internet Explorer Developer之一中居中 > Internet Explorer开发论坛 位于此处: http://social.msdn.microsoft.com/Forums/zh-CN/category/iedevelopment .


这篇关于向Web控件添加样式-3种方法只能做到一种? (Internet Explorer 7)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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