2011年10月31日

完整HACK代码:

select {
background-color
:cccccc\0;/* ie 8/9*/
background-color
:eeeeee\9\0;/* ie 9*/
*background-color
:#dddd00;/* ie 7*/
_background-color
:#CDCDCD;/* ie 6*/
}

其中:
background-color:cccccc\0;IE8和IE9都支持;
background-color:eeeeee\9\0; 仅IE9支持;

另外,background-color:eeeeee\9;的HACK支持IE6-IE8,但是IE8不能识别“*”和“_”的CSS HACK。

可综合上述规律灵活应用。


 

posted @ 2011-10-31 03:21 eecc 阅读(1468) 评论(9) 编辑

2011年10月26日

利用<a>标签的a:hover状态触发鼠标移过的动作,其中未触发状态显示为单个图片。兼容IE6/7/8以及FF/Chrome等主流浏览器。以下是图示及完整代码。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<title>对话商业领袖_网易财经</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta content="all" name="robots" />
<meta name="author" content="Netease" />
<meta name="Copyright" content="Netease" />
<meta name="keywords" content="" />
<base target="_blank" />
<style>
*
{margin:0px;padding:0px;}
body
{ text-align:left; font-size:12px;}
ul.onMShow
{width: 110px;}
ul.onMShow li
{list-style:none; background-position:left top; background-repeat:no-repeat;}
ul.onMShow li a
{position: relative;display:block; width:200px; height:50px;border:none; }
ul.onMShow li a div
{display: none;}
ul.onMShow li a:hover
{background::none;display:block; width:auto;}/*此处需定义宽度,否则IE6下无法正常显示*/
ul.onMShow li a:hover div
{display:block;position: absolute;padding:5px;width: 272px;left:0px;top: 0px;border: 1px solid #BDBDBD;background-color: #E4F6FF;cursor:pointer;}
ul.onMShow li a img
{width:80px;height:80px;border:none;display:block;position: absolute;top:5px;left:5px;}
ul.onMShow li dl
{width:180px;float:right;color: #000;line-height:20px;}
ul.onMShow li dl dd span
{font-weight: bold;color: #000; margin-right:5px;}
ul.onMShow li dl dd h5
{ font-size:12px; color:#979797; display:inline; font-weight:normal;}
</style>
</head>
<body>
<ul class="onMShow">
<li style="background-image:url(http://img4.cache.netease.com/stock/2009/9/5/2009090523262247607.png)"><a href="http://money.163.com/09/0703/18/5DALA0IV002526O5.html"><br /><div><img src="http://img3.cache.netease.com/stock/2009/9/5/2009090523262766842.png" alt="常德传" />
<dl>
<dd><span>常德传</span><h5>青岛港集团董事局主席</h5></dd>
<dd>在困难的时候企业就是要手拉手,肩并肩,不能想单打独斗,抱团合作是唯一出路。</dd>
</dl></div></a></li>
</ul>
</body>
</html>
posted @ 2011-10-26 17:23 eecc 阅读(1442) 评论(5) 编辑

2011年10月25日

理念:

1. reset 的目的不是清除浏览器的默认样式,这仅是部分工作。清除和重置是紧密不可分的。

2. reset 的目的不是让默认样式在所有浏览器下一致,而是减少默认样式有可能出现的问题。

3. reset 期望提供一套普适通用的基础样式。推荐根据具体需求,裁剪和修改后再使用。

特色:

1. 适应中文;

2. 基于最新主流浏览器。

/** 清除内外边距 **/
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote,
/* structural elements 结构元素 */
dl, dt, dd, ul, ol, li,
/* list elements 列表元素 */
pre,
/* text formatting elements 文本格式元素 */
form, fieldset, legend, button, input, textarea,
/* form elements 表单元素 */
th, td
/* table elements 表格元素 */ {margin: 0;padding: 0;}

/** 设置默认字体 **/
body, button, input, select, textarea
/* for ie */ {font: 12px/1.5 tahoma, arial, simsun, sans-serif;}
h1, h2, h3, h4, h5, h6
{font-size: 100%;}
address, cite, dfn, em, var
{ font-style: normal; } /* 将斜体扶正 */
code, kbd, pre, samp
{ font-family: courier new, courier, monospace; } /* 统一等宽字体 */
small
{ font-size: 12px; } /* 小于 12px 的中文很难阅读,让 small 正常化 */

/** 重置列表元素 **/
ul, ol
{ list-style: none; }

/** 重置文本格式元素 **/
a
{ text-decoration: none; }
a:hover
{color:#ff6600;}
sup
{ vertical-align: text-top; } /* 重置,减少对行高的影响 */
sub
{ vertical-align: text-bottom; }

/** 重置表单元素 **/
legend
{ color: #000; } /* for ie6 */
fieldset, img
{ border: 0; } /* img 搭车:让链接里的 img 无边框 */
button, input, select, textarea
{ font-size: 100%; } /* 使得表单元素在 ie 下能继承字体大小 */
/* 注:optgroup 无法扶正 */

/** 重置表格元素 **/
table
{ border-collapse: collapse; border-spacing: 0; }
body
{width:990px;margin:0 auto;text-align:center;}
img
{vertical-align:top;}
.clearing
{clear:both;height:0;visibility:hidden;display:block;overflow:hidden;}
posted @ 2011-10-25 00:11 eecc 阅读(1252) 评论(3) 编辑

2011年10月23日

浮动元素由于脱离了文档流,无法撑起其父元素的高度,如果父元素要显示背景或边框时就不能置之不理了。使浮动元素的父容器自适应高度的方法有三种:

方法一:让浮动元素后面紧跟一个用于清除浮动的空标签。完整代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>clearfix</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<style type="text/css">
.area
{background:#ccc;}/*定义父容器背景颜色,以便于观察*/
.fl
{float:left;background:#FFDF00;}
.cb
{clear:both;}
</style>
</head>
<body>
<div class="area">
<div class="fl">floater</div>
<div class="cb"></div>
</div>
</body>
</html>

缺点:增加了一个空标签,破坏了语义化。

方法二:给父容器加上一个特殊的class,直接从父容器清除浮动元素的浮动。完整代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>clearfix</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<style type="text/css">
.area
{background:#ccc;}/*定义父容器背景颜色,以便于观察;定义宽度,使其在IE下高度自适应*/
.clearfix:after
{height:0px;visibility:hidden;content:".";clear:both;display:block;}
.fl
{float:left;background:#FFDF00;}
.clearfix
{display:inline-block;}/* 对Mac上的IE浏览器进行的处理 */
* html .clearfix
{height:1%}/* 对win上的IE浏览器进行的处理 */
.clearfix
{display:block;}/* 对display: inline-block;进行的修改,重置为区块元素*/
</style>
</head>
<body>
<div class="area clearfix">
<div class="fl">floater</div>
</div>
</body>
</html>

方法三:在方法二的基础上进行改进。完整代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>clearfix</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-CN" />
<style type="text/css">
.area
{background:#ccc;width:960px;}/*定义父容器背景颜色,以便于观察;定义宽度,使其在IE下高度自适应*/
.clearfix:after
{height:0px;visibility:hidden;content:".";clear:both;display:block;}
.fl
{float:left;background:#FFDF00;}
</style>
</head>
<body>
<div class="area clearfix">
<div class="fl">floater</div>
</div>
</body>
</html>
posted @ 2011-10-23 13:02 eecc 阅读(1008) 评论(5) 编辑

2008年8月7日

如果不用ref传递的是原引用变量的副本,即把原来的引用变量复制一分传递给方法;
如果用ref传递的是原引用变量的引用。

  class   a   
{
int val;
}
class test
{
public static void Main()
{
a a1=new a();
changeIt(a1);
Console.WriteLine(a1.val.toString());
}
private static void changeIt(a objects)
{
objects.val=100;
}
}


运行结果肯定都是:100(因为引用变量和引用变量的副本是一样的,它们指向同一个对象) 

 class   a   
{
int val;
}
class test
{
public static void Main()
{
a a1=new a();
changeIt(ref a);
Console.WriteLine(a1.val.toString());
}
private static void changeIt(ref a objects)
{
a obj = new a();
obj.val = 200;
objects = obj;
}
}

运行结果肯定都是:200 (changeIt方法使原来的引用变量指向了另一个对象即在用ref时可以改变原引用变量的指向,使用时要小心,需要时使用)。 

posted @ 2008-08-07 15:28 eecc 阅读(219) 评论(0) 编辑

2008年7月29日

摘要: Default.aspx全部代码:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><%@PageLanguage="C#"AutoEventWireup="true"%><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"阅读全文
posted @ 2008-07-29 10:54 eecc 阅读(3052) 评论(4) 编辑

2008年5月5日

摘要: 说的通俗一些,就是: 有一个叫做EventHandler 的家伙,他会告诉你(主程序),有一些事情发生了:这个事情是谁导致的呢?是某个object类型对象导致的,它用Source或Sender来表示。这个事情是什么事呢?e的内容就是事情的内容了。 至于Source和Sender,没有区别,你想用哪个就用哪个,其实都是一样的。 所以,我们在程序中的事件处理函数就是依赖于这个东西实现的:比方说你点了一...阅读全文
posted @ 2008-05-05 13:50 eecc 阅读(1992) 评论(4) 编辑

导航

随笔分类

随笔档案

最新评论