日志内容

2006-01-07[原]修正IE6的3像素BUG

TAG:CSS 原创 代码分享

在IE6中使用浮动之后,在浮动对象的后面会出现3像素的间隔,在网上找到两种方法,不过原理还没弄懂,下面是例子:
一,CSSPLaY上的例子,主要是文字的:

------------------------CSS代码----------------------------
.holder {
   border: 1px solid #000000;
   display: block;
   height: 150px;
   margin: 2em auto 0 auto;
   width: 300px;
}
.float {
   background: #E09222;
   color: #FFFFFF;
   float: left;
   height: 60px;
   text-align: center;
   width: 100px;
}
.error {
   display: block;
   margin-left: 100px;
   padding-left: 5px;
   text-align: left;
}
.correct {
   display: block;
   margin-left: 100px;
   padding-left: 5px;
   text-align: left;
}
* html .correct {
   display: inline-block; /*将对象呈递为内联对象,但是对象的内容作为块对象呈递。旁边的内联对象会被呈递在同一行内*/
   padding-left: 2px;
}
---------------------------------------------------------------
------------------------HTML代码----------------------------
<div class="holder">
<div class="float">ERROR</div>
<div class="error">|||||||||||||||||||||||<br />|||||||||||||||||||||||<br />|||||||||||||||||||||||<br />|||||||||||||||||||||||
<br />|||||||||||||||||||||||<br />|||||||||||||||||||||||
</div>
</div>
<p class="bold">IE6的3像素BUG</p>

<div class="holder">
<div class="float">FIXED</div>
<div class="correct">|||||||||||||||||||||||<br />|||||||||||||||||||||||<br />|||||||||||||||||||||||<br />|||||||||||||||||||||||
<br />|||||||||||||||||||||||<br />|||||||||||||||||||||||
</div>
</div>
<p class="bold">修正后效果</p>
---------------------------------------------------------------

二,另一个例子是E库技术学院上的,有提到了层的解决方案:

------------------------CSS代码----------------------------
 *{
  padding: 0;
  margin: 0;
 }
 #layout{
 background: #F1F1F1;
 width: 400px;
 float: left;
 }
 #floatbox {
 float: left;
 width: 100px;
 height: 50px;
 background: #6d6;
 }
 p {
 margin: 0 0 0 100px;
 background: #dd9;
 }
 * html #floatbox {
 margin-right: -3px;
 }
 * html p {
 height: 1%;
 margin-left: 0;
 }

---------------------------------------------------------------
------------------------HTML代码----------------------------
<div id="layout"><div id="floatbox">floatbox</div><p>现在没有3px了</p><p>现在没有3px了</p></div>


2006-01-06一个不错的图片浏览效果

TAG:CSS 代码分享

哈哈,又有好东东了,在CSSPLaY淘到一个不错的图片浏览效果,代码我已经加了注解,没有什么特别的代码。
原文章及效果演示
---------------------------CSS代码---------------------------------
#gallery {
  padding:0; /* 清除内补丁 */
  margin:0; /* 清除外补丁 */
  list-style-type:none; /* 隐藏链接样式 */
  overflow:hidden; /* 隐藏超出的部分 */
  width:320px; /* 定义总宽度 */
  height:425px; /* 定义总高度 */
  border:1px solid #888; /* 定义边框 */
  background:#fff url(windows/win_back.gif); /* 定义背景 */
  }
#gallery li {
  float:left;/* 清除li间距 */
  }
#gallery li a {
  display:block; /* 定义成块 */
  height:30px; /* 定义微缩图高度 */
  width:320px; /* 定义微缩图宽度 */
  float:left; /* 清除间距 */
  text-decoration:none; /* 清除文字样式 */
  border-bottom:1px solid #fff; /* 添加底部边框 */
  cursor:default; /* 定义鼠标样式 */
  }
#gallery li a img {
  width:320px; /* 图片宽度 */
  height:30px; /* 图片高度 */
  border:0; /* 去除边框 */
  }
#gallery li a:hover {
  background:#eee; /* 鼠标经过时li的背景 */
  height:239px; /* 鼠标经过时li的高度 */
  }
#gallery li a:hover img {
  height:239px; /* 鼠标经过时图片的高度 */
  }
----------------------------------------------------------------------
---------------------------HTML代码---------------------------------
<ul id="gallery">
<li><a href="#nogo">
<img src="windows/win7.jpg" alt="#1" title="#1" /></a></li>
<li><a href="#nogo">
<img src="windows/win8.jpg" alt="#2" title="#2" /></a></li>
<li><a href="#nogo">
<img src="windows/win9.jpg" alt="#3" title="#3" /></a></li>
<li><a href="#nogo">
<img src="windows/win10.jpg" alt="#4" title="#4" /></a></li>
<li><a href="#nogo">
<img src="windows/win11.jpg" alt="#5" title="#5" /></a></li>
<li><a href="#nogo">
<img src="windows/win12.jpg" alt="#6" title="#6" /></a></li>
<li><a href="#nogo">
<img src="windows/win13.jpg" alt="#7" title="#7" /></a></li>
</ul>
------------------------------------------------------------------------
兼容IE5+和FF,Opera就不清楚了,没试过。


2006-01-05[原]用target实现动态效果

TAG:CSS 代码分享 原创

今天在CSSPLaY淘到了一个不错的效果,可惜IE不支持。越来越觉得IE不爽了!!
-------------------------------css代码---------------------------------
<style type="text/css">
<!--
#change:target {
   color: #C00;/*字体颜色:红色*/
}
#wrapper:target {
   background: #F0C992;/*背景颜色:土黄*/
}
#inf:target {/*在标题下面添加横线*/
   border-bottom: 5px solid #697210;
   color: #697210;
   padding-bottom: 5px;
}
#inf:target :before {/*在标题前面添加"MY "字符*/
   color: #697210;
   content: "MY ";
   font-size: 1em;
}
#inf:target :after {/*在标题前面添加" PAGE"字符*/
   color: #697210;
   content: " PAGE";
   font-size: 1em;
}
#head:target {/*图片名:back3.gif*/
   background: url(back3.gif) #FFFFFF no-repeat 345px 5px;
}
#info li {
   line-height: 1.7em;
}
-->
</style>
------------------------------------------------------------------------
-----------------------------html代码---------------------------------
<div id="change">
<div id="wrapper">
<div id="head">

<h2 id="inf">TARGET PRACTISE</h2>
<ol>
<li><a href="#change">改变文字颜色为红色</a></li>
<li><a href="#wrapper">改变背景颜色为土黄</a></li>
<li><a href="#inf">改变标题文字</a></li>
<li><a href="#head">改变标题图片</a></li>
</ol>

</div>
</div>
</div>
------------------------------------------------------------------------
只需要在链接上用锚点就可以实现类似JScript的效果。
这个功能不能在IE和Opera中实现。


2006-01-03特别的表单定义

TAG:CSS 代码分享

今天在网上看到的一个CSS样式表,转下来分享:
---------------------------------------------------------------
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>FireFox / Mozilla / Opera / IE 适用</title>
<style type="text/css" by tesion.>
/* CSS v.02 by tesion.
CopyRight: http://www.netjoin.net
Contact: renziweb@hotmail.com
原创表单变色
*/
/*定义全局样式 */
input,select,textarea,div {
font: 12px Arial
/* 此部分为表单和容器的字体定义 */
}
/* 所有表单定义默认 */
input,select,textarea {
border: 1px solid #EFEFEF;
}
/* 利用鼠标事件 :hover 来定义当鼠标经过时样式 */
input:hover,select:hover,textarea:hover {
background: #F0F9FB;
border: 1px solid #1D95C7;
}
/* 由于 :hover 事件只有 Mozilla 支持,因此为方便IE使用 expression 批量定义 */
input,select,textarea {
tesion:expression(onmouseover=function()
{this.style.backgroundColor="#F0F9FB";this.style.border="1px solid #1D95C7"},
onmouseout=function()
{this.style.backgroundColor="#FFFFFF";this.style.border="1px solid #EFEFEF"})
}
/* 如上 */
div {
background: #EFEFEF;
padding: 10px; /* 填充 */
cursor: pointer /* 鼠标 */
}
div:hover {
background: #F0F9FB
}
div {
tesion:expression(onmouseover=function()
{this.style.backgroundColor="#F0F9FB"},
onmouseout=function()
{this.style.backgroundColor="#EFEFEF"})
}
/* 不错吧? */
</style>
</head>
<body>
<p>
  <input type="text" size="20" maxlength="16" />
  <br />
  <select name="select">
  </select>
  <br />
  <textarea name="textarea"></textarea>
</p>
<div>这么简单</div>
</body>
</html>
---------------------------------------------------------------
转自特别的表单定义


2005-12-31常用CSS2基本定义例子

TAG:CSS 代码分享 文章分享

[ 2005-07-29 11:04:52 | Author: 一叶千鸟 ]

大部分定义根据项目需求定制,并不适合每个网站,提出一种思路,抛砖引玉。

1,主要兼容MOZ & IE6。好多年不用IE5.x了,而且也没测试环境,工作和自己项目都已不考虑IE5;
2,定义名主要采用单字母识别。主要是自己使用,减少代码,语意描述显然不是很好;
3,大量采用包含选择符增加定义重用,定义写法上重复都为合写,可读性同样不是那么好;
4,链接部分定义适用于触发不换色,只增加下划线;

欢迎提出意见。可能部分定义对兼容有潜在的影响,个人使用不断更新。

语言定义
常被忽略,但我总喜欢加上

@charset "gb2312";


全局宏观定义
html,body标签,以及MOZ的模块兼容
html,body { margin:0 auto; font:12px Arial,Helvetica,sans-serif,宋体; line-height:150%; TEXT-ALIGN:center; overflow-x:hidden; color:#000;}
body>table,body>div { margin-left:auto; margin-right:auto; clear:both;} /* M0Z */

全局微观定义
各容器和表单,主要控制文字、图片

table,div,tr,th,td,ul,li,img,form,h2,h3,h4 { font:12px Arial,Helvetica,sans-serif,宋体; margin:0; padding:0; border:0; color:#000;}
div,td,ul,li,h2,h3,h4 { LIST-STYLE-TYPE: none; word-break:break-all; Width:fixed; text-align:justify; text-justify:inter-ideograph; line-height:150%; border:0;}
input,select,textarea { color:#000; font:12px Arial,Helvetica,sans-serif,宋体;}

全局链接定义
触发出现下划线,链接颜色不变

a { font:12px Arial,Helvetica,sans-serif,宋体; color:#000; text-decoration: none;}
a:hover { text-decoration:underline;}

文字-标题

h2,h2 a { font-size:16px; font-weight:bold;}
h3,h3 a { font-size:14px; font-weight:bold;}
h4,h4 a { font-size:12px; font-weight:bold;}

文字-加粗与下划线

.f_b {}
.fs_b,.f_b * { font-weight:bold;}
.f_u {}
.fs_u,.f_u * { text-decoration:underline;}


文字-链接下划线效果

.a_vl a:link,.a_vl a:visited { text-decoration:underline;}
.a_vl a:hover{ text-decoration:none;} /* 触发无 */
.a_hl a:link,.a_hl a:visited { text-decoration:none;}
.a_hl a:hover{ text-decoration:underline;} /* 触发有 */
.a_nl a:link,.a_nl a:visited { text-decoration:none;}
.a_nl a:hover{ text-decoration:none;} /* 永久无 */

文字-大小

.f_s_10,.f_s_10 * { font-size:10px;}
.f_s_12,.f_s_12 * { font-size:12px;}
.f_s_14,.f_s_14 * { font-size:14px;}
.f_s_16,.f_s_16 * { font-size:16px;}

文字-颜色

.a_c_black,.a_c_black * { color:#000;}
.a_c_gray,.a_c_gray * { color:#666;}
.a_c_white,.a_c_white * { color:#fff;}
.a_c_red,.a_c_red * { color:#f00;}

图片-边框

.b_black {}
.bs_black,.b_black img { border:1px #000 solid;}
.b_gray {}
.bs_gray,.b_gray img { border:1px #999 solid;}
.b_white {}
.bs_white,.b_white img { border:1px #fff solid;}

图片-通栏广告
常用宽度通栏,包含纵向外补丁,兼容MOZ

.ban,.ban_white,.ban_black { width:760px;}
.ban img { margin:5px auto;}
.ban_white img { margin:5px auto; border:1px #fff solid;}
.ban_black img { margin:5px auto; border:1px #000 solid;}

列表-行高

.l_16,.l_16 * { line-height:16px;}
.l_18,.l_18 * { line-height:18px;}
.l_20,.l_20 * { line-height:20px;}
.l_22,.l_22 * { line-height:22px;}
.l_24,.l_24 * { line-height:24px;}
.l_26,.l_26 * { line-height:26px;}
.l_28,.l_28 * { line-height:28px;}
.l_30,.l_30 * { line-height:30px;}

列表-高度

.l_h_18,.l_h_18 * { height:18px;}
.l_h_20,.l_h_20 * { height:20px;}
.l_h_22,.l_h_22 * { height:22px;}

列表-单元格宽

.l_t_20 {}
.l_t_20 td { width:20%;}
.l_t_25 {}
.l_t_25 td { width:25%;}

列表-补丁
列表的横向内补丁

.l_p_5 {}
.l_p_5 * { padding-left: 5px;padding-right: 5px;}
.l_pr_5 {}
.l_pr_5 * { padding-right: 5px;}

浮动-位置,偏移,对齐
组合定义,控制位置左中右,控制左右浮动列表,单元格居顶,图片、表单的横向对齐

.t_l,.t_l * { text-align:left;}
.t_c,.t_c * { text-align:center;}
.t_r,.t_r *,.f_la,.f_lb,.f_ld,.f_ls { text-align:right;}
.f_l,.f_la a,.f_lb b,.f_ld div,.f_ls span { float:left;} /* f_la f_lb f_ld f_ls */
.f_r { float:right;}
.v_t { vertical-align:top;}
.v_m,.v_m_o,.v_m_o * { vertical-align:middle;}

间隔-内补丁
常用内补丁组合定义

.p_5 { padding: 5px;}
.p_t_5 { padding-top: 5px;}
.p_l_5 { padding-left: 5px;}
.p_r_5 { padding-right: 5px;}
.p_ape_5 { padding-top: 5px;padding-bottom: 5px;} /* apeak */
.p_lev_5 { padding-left: 5px;padding-right: 5px;} /* level */
.p_10 { padding: 10px;}
.p_t_10 { padding-top: 10px;}
.p_l_10 { padding-left: 10px;}
.p_r_10 { padding-right: 10px;}
.p_ape_10 { padding-top: 10px;padding-bottom: 10px;} /* apeak */
.p_lev_10 { padding-left: 10px;padding-right: 10px;} /* level */

间隔-外补丁
常用外补丁组合定义

.m_t_5 { margin:5px auto 0 auto;}
.m_a_5 { margin:5px auto;}

兼容
MOZ层自动延伸,清除浮动,MOZ居中

.h_h { height:0; clear:both; overflow:hidden; margin:0 auto;} /* M0Z */
.c_c { clear:both;}
.c_m,.c_l_m,.c_l_m div { margin:0 auto;} /* M0Z */


分页 共15页 第一页 上一页 6 7 8 9 10 11 12 13 14 15 下一页 最后一页
订阅>>使用RSS邮天下订阅>>Google订阅s

Q我 GTalk联系

Recent Articles

Recent Comments

Recommend

Archive

广 州
The WeatherPixie

Search Engine Optimization

CSS森林:30247792
(精神正常者慎入!)

访问统计:

011 本BLOG[原]部分的内容采用创作共用授权,请尊重劳动成果,谢谢。
Copyright © 2006 风的影子. All rights reserved.   FORESt.blOGbUS.COM  BLOGBUS.COM