Category ArchiveHTML/XHTML/CSS



HTML/XHTML/CSS & 技术 17 Jul 2008 02:47 pm

如果flash将层挡住了怎么办?

<param name=”wmode” value=”opaque”>

加上一句

HTML/XHTML/CSS & 技术 04 Jun 2008 11:24 am

textarea在ie7存在自适应宽度bug

使用css width:99%控制宽度,当你从文本文件中粘贴一篇无换行的文章时,textarea的滚动条会自动跳至文本框顶部,影响输入。估计是ie7不能准确显示无换行内容的高度,在ie6,ff下无此问题。

解决方法是去掉css,在textarea中用cols=90 写死宽度,IE7宽屏显示效果会差点,在FF下由于外部套了table仍然会自适应宽度。

HTML/XHTML/CSS & 技术 08 Oct 2007 01:50 pm

前端开发工程师的工具箱 2007-09-25

来自TAOBAO的UED推荐

http://docs.google.com/Present?docid=dgr8f7vc_46gmggrv&fs=true

Google Presentation 目前的功能相比PowerPoint还很简单,只能插入图片和文本,不支持动画。但相信这些功能很快就会出现。

creasemonkey
fiddle
Internet Explorer Developer Toolbar
ie7pro
firebug
yslow
web develop

HTML/XHTML/CSS & 技术 16 Apr 2007 01:11 pm

li标签的间距问题

  1. body{font-size:12px;margin:0}
  2. ul{list-style:none;margin:0;padding:0;}
  3. ul li{background:green;height:20px;width:120px;vertical-align: bottom;}
  4. ul li a{color:#fff;padding:0 0 0 10px;}

1.解决li在IE5下产生空白行距的方法:如果li定义了宽度,那么需要在li里面再定义vertical-align: bottom;
2.宽度最好不要定义在UL,定义在LI或者UL外层的DIV里面
3. 书写LI的最佳方式,li里面要书写高度和宽度,以及vertical-align: bottom;(for ie5/win bug),或者在ul外面加上一层div,并定义宽度,那么在li里面不用定义宽度和vertical-align: bottom;,也显示正常(IE5下不会产生空白行距),不过高度还是要定义一下的。

HTML/XHTML/CSS & 技术 10 Apr 2007 10:34 am

css display属性小记

visibility属性用来确定元素是显示还是隐藏,这用visibility=”visible|hidden”来表示,visible表示显示,hidden表示隐藏。
当visibility被设置为”hidden”的时候,元素虽然被隐藏了,但它仍然占据它原来所在的位置。

table的display为’table’时在ie下会出错,ff下没事,干脆显示时用display=”;

HTML/XHTML/CSS & JavaScript/DOM/XML & 技术 15 Dec 2006 11:17 am

统一textarea在IE、Firefox下的效果

textarea在IE是默认有滚动条的,而FF没有滚动条的。
解决方法:
1、用textarea的宽度(widht)和高度(height)来定义textarea的大小;
2、让滚动条自适应:overflow-y:auto。
3、使用js来自适应高度

  1. <style type="text/css">
  2.         #content {
  3.           font-size: 12px;
  4.           overflow:hidden;
  5.           background-color: #fff;
  6.           color: #000;
  7.           padding-right:5px;
  8.           padding-left:5px;
  9.           font-family: courier;
  10.           width:100px;
  11.           letter-spacing:0;
  12.           line-height:12px;
  13.           border-style:1px #ccc solid;
  14.         }
  15.       </style>
  16.       <script language="JavaScript">
  17.  
  18.         function setRows() {
  19.           var textarea = document.getElementById("content");
  20.           var cols = textarea.cols;
  21.           var str = textarea.value;
  22.           // windows - replace \r\n
  23.           // mac - replace just \r
  24.           // linux - is just \n
  25.           str = str.replace(/\r\n?/, "\n");
  26.           var lines = 2;
  27.           var chars = 0;
  28.           for (i = 0; i < str.length; i++) {
  29.             var c = str.charAt(i);
  30.             chars++;
  31.             if (c == "\n" || chars == cols) {
  32.               lines ++;
  33.               chars = 0;
  34.             }
  35.           }
  36.           textarea.setAttribute("rows", lines);
  37.           textarea.style.height = lines*12 + "px";
  38.         }
  39.  
  40.       </script>
  41.       <span>test textarea</span><br>
  42.       <textarea id="content"  rows="2" cols="10" onkeyup="setRows();"></textarea>

当输入连续字符超出textarea宽度边界时,ie会自动换行,而FF会出现水平滚动条。
解决方法:
1、你可以设 overflow-x:hidden;将超出部分隐藏。
2、使用js,但需考虑手动换行,中英文还有英文单词。

HTML/XHTML/CSS & JavaScript/DOM/XML & 技术 06 Dec 2006 01:44 pm

offsetHeight在ie和ff下的差异

当你的html没设DTD时,设置一个div并包含一张图片,ie的offsetHeight会多出4个象素。

解决方法是去掉img标签后的换行.让

  1. </img>后紧跟</div>

或者使用js来判断浏览器。

当你设一div width=50px border=1px,ie的offsetHeight和clientHeight分别是50px和48px,ff是52px和50px

HTML/XHTML/CSS & JavaScript/DOM/XML & 技术 05 Dec 2006 01:38 pm

scrollLeft,scrollWidth,clientWidth,offsetWidth到底指的哪到哪的距离

IE6.0、FF1.06+:
clientWidth = width + padding
clientHeight = height + padding
offsetWidth = width + padding + border
offsetHeight = height + padding + border
IE5.0/5.5:
clientWidth = width - border
clientHeight = height - border
offsetWidth = width
offsetHeight = height
(需要提一下:CSS中的margin属性,与clientWidth、offsetWidth、clientHeight、offsetHeight均无关)

scrollleft