<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>枫芸志 &#187; CSS</title>
	<atom:link href="http://witmax.cn/tag/css/feed" rel="self" type="application/rss+xml" />
	<link>http://witmax.cn</link>
	<description>记录成长路途上的点滴总结</description>
	<lastBuildDate>Sat, 04 Feb 2012 13:47:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>【CSS】左侧定宽、右侧宽度自适应布局</title>
		<link>http://witmax.cn/css-layout-1.html</link>
		<comments>http://witmax.cn/css-layout-1.html#comments</comments>
		<pubDate>Sun, 05 Jun 2011 06:36:58 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1606</guid>
		<description><![CDATA[又是一道前端的面试题，请实现页面布局，包括页头、内容区域、页脚三部分，其中内容区域为左右分栏，左栏定宽200px、右栏自适应宽度。 虽然是以前应用中碰到过的布局，但现场还是没写对，来重新做一下。 &#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=gb2312&#34; /&#62; &#60;title&#62;双列布局，左侧定宽，右侧自适应&#60;/title&#62; &#60;style&#62; html,body{ height:100%; margin:0px; padding:0px; } #header { width:100%; height:20px; background:#CCC; } #footer { width:100%; height:20px; background:#CCC; } #main { padding-left: 200px; } #left { width:200px; height:200px; position:absolute; left:0; background:#FF0;} #middle { width:100%; height:200px; background:#F00; } [...]]]></description>
			<content:encoded><![CDATA[<p>又是一道前端的面试题，<strong>请实现页面布局，包括页头、内容区域、页脚三部分，其中内容区域为左右分栏，左栏定宽200px、右栏自适应宽度。</strong></p>
<p>虽然是以前应用中碰到过的布局，但现场还是没写对，来重新做一下。</p>
<p><span id="more-1606"></span></p>
<div class="runcode">
<p><textarea name="runcode" style="height:260px;width:540px;font-size:12px" class="runcode_text" id="runcode_ctP75V"> &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot; /&gt;
&lt;title&gt;双列布局，左侧定宽，右侧自适应&lt;/title&gt;
&lt;style&gt;
    html,body{ height:100%; margin:0px; padding:0px; }
    #header { width:100%; height:20px; background:#CCC; }
 #footer { width:100%; height:20px; background:#CCC; }
    #main { padding-left: 200px; }
    #left { width:200px; height:200px; position:absolute; left:0; background:#FF0;}
    #middle { width:100%; height:200px; background:#F00; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;header&quot;&gt;header&lt;/div&gt;
&lt;div id=&quot;main&quot;&gt;
    &lt;div id=&quot;left&quot;&gt;left&lt;/div&gt;
    &lt;div id=&quot;middle&quot;&gt;middle&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;footer&quot;&gt;footer&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_ctP75V');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_ctP75V');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_ctP75V','runcode_ctP75V');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>知其然知其所以然，简单分析一下。页头、内容区域、页脚三块划分没什么好说的，主要是左右分栏。为保证右侧div能撑满右侧，需要设width:100%；左右的div需要在同一行上，而右侧div已经撑满一行了，于是左侧div的做法就是从文档流中分离，设置position:absolute；此时左右两个div发生重叠，需要将右侧div内容宽度减少200px并相应右移，给左侧div留出空间，设定main的padding-left:200px; 发现左侧div的内容也向右偏移了200px，需要左移回去，所以设置left:0。这样布局就完成了。</p>
<p>以上是中间区域双栏实现，现在改成左中右三栏的样式，代码如下：</p>
<div class="runcode">
<p><textarea name="runcode" style="overflow-y:visible;width:540px;font-size:12px" class="runcode_text" id="runcode_UDbWi9"> &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot; /&gt;
&lt;title&gt;双列布局，左侧定宽，右侧自适应&lt;/title&gt;
&lt;style&gt;
    html,body{ height:100%; margin:0px; padding:0px; }
    #header { width:100%; height:20px; background:#CCC; }
	#footer { width:100%; height:20px; background:#CCC; }
    #main { padding-left: 200px; padding-right: 200px;}
    #left { width:200px; height:200px; position:absolute; left:0; background:#FF0;}
    #right { width:200px; height:200px; position:absolute; right:0; background:#FF0; float:left;}
    #middle { width:100%; height:200px; background:#F00; float:left;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id=&quot;header&quot;&gt;header&lt;/div&gt;
&lt;div id=&quot;main&quot;&gt;
    &lt;div id=&quot;left&quot;&gt;left&lt;/div&gt;
    &lt;div id=&quot;middle&quot;&gt;middle&lt;/div&gt;
    &lt;div id=&quot;right&quot;&gt;right&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&quot;footer&quot;&gt;footer&lt;/div&gt;
&lt;/body&gt;
&lt;html&gt;</textarea></p>
<script type="text/javascript">function changeTsize(){document.getElementById("runcode_UDbWi9").style.height = document.getElementById("runcode_UDbWi9").scrollHeight + "px";}window.setTimeout(changeTsize,0);</script><p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_UDbWi9');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_UDbWi9');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_UDbWi9','runcode_UDbWi9');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/css-layout-1.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Web前端开发笔试题集锦（HTML/CSS篇）</title>
		<link>http://witmax.cn/web-dev-test-html.html</link>
		<comments>http://witmax.cn/web-dev-test-html.html#comments</comments>
		<pubDate>Sun, 08 May 2011 12:17:35 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=1593</guid>
		<description><![CDATA[以下为Web前端开发笔试题集锦之HTML/CSS篇，移步Javascript篇 1，让一个input的背景颜色变成红色 2，div的高宽等于浏览器可见区域的高宽，浏览器滚动，div始终覆盖浏览器的整个可见区域 思路： (1)先放置一个div1，浮动：position:absolute;top:0px;left:0px; (2)再放置一个div2，浮动：position:absolute;top:0px;left:0px;width:100%;height:100%; (3)在div2中放置一个div3，令其高度超过浏览器高度，使div2产生滚动条 (4)对html,body进行样式设置：width:100%;height:100%;overflow:hidden-&#62;不让浏览器产生滚动条，避免页面出现两个滚动条 (5)编写JavaScript，另div2的高度等于页面可见高度，宽度等于页面可见宽度，注意，在计算完可见高度height和可见宽度width后，要对这两个值做处理，可见宽度-div2的滚动条的宽度，滚动条的宽度我这里假设是20px 这样题目基本就完成了，不过浏览器的兼容性还不是很好。 贴出代码： 3，IE、FF下面CSS的解释区别 （1） 让页面元素居中 ff{margin-left:0px;margin-right:0px;width:***} ie上面的设置+text-align:center （2） ff：不支持滤镜 ie：支持滤镜 （3） ff：支持!important ie支持*，ie6支持_ （4） min-width,min-height FF支持，IE不支持，IE可以用css expression来替代 （5） Css Expression FF不支持，IE支持 （6） cursor：hand IE下可以显示手指状，FF下不行 （7） UL的默认padding和margin IE下ul默认有margin，FF下ul默认有padding （8） FORM的默认margin IE下FORM有默认margin，FF下margin默认为0 4，一个定宽元素在浏览器（IE6，IE7，Firefox）中横向居中对齐的布局，请写出主要的HTML标签及CSS 思路： IE6/7：text-align:center Firefox：margin:0 auto(margin-top和margin-bottom也可以为其他数字，关键是margin-left,margin-right为auto) 贴出代码： 5，CSS中margin和padding的区别 margin是元素的外边框，是元素边框和相邻元素的距离 Padding是元素的内边框，是元素边框和子元素的距离 6，最后一个问题是，如何制作一个combo选项，就是可以输入可以下拉菜单选择。 思路： （1）布局select和input，让input覆盖select，除了select的下拉图标，以方便select选择 （2）编写JS，为select添加onchange事件，onchange时将input的value置成select选中的指 贴出代码 7，&#60;img&#62;中alt和tittle的区别 alt：图片显示不出来了就提示alt [...]]]></description>
			<content:encoded><![CDATA[<p>以下为Web前端开发笔试题集锦之HTML/CSS篇，移步<a href="http://witmax.cn/web-dev-test-js.html">Javascript篇</a></p>
<p><strong>1，让一个input的背景颜色变成红色</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;input type=&quot;text&quot; style=&quot;background:red;&quot;/&gt;</pre>
<p><strong>2，div的高宽等于浏览器可见区域的高宽，浏览器滚动，div始终覆盖浏览器的整个可见区域</strong></p>
<p>思路：</p>
<p>(1)先放置一个div1，浮动：position:absolute;top:0px;left:0px;</p>
<p>(2)再放置一个div2，浮动：position:absolute;top:0px;left:0px;width:100%;height:100%;</p>
<p>(3)在div2中放置一个div3，令其高度超过浏览器高度，使div2产生滚动条</p>
<p>(4)对html,body进行样式设置：width:100%;height:100%;<strong>overflow:hidden-&gt;不让浏览器产生滚动条，避免页面出现两个滚动条</strong></p>
<p><span id="more-1593"></span></p>
<p>(5)编写JavaScript，另div2的高度等于页面可见高度，宽度等于页面可见宽度，注意，在计算完可见高度height和可见宽度width后，要对这两个值做处理，可见宽度-div2的滚动条的宽度，滚动条的宽度我这里假设是20px</p>
<p>这样题目基本就完成了，不过浏览器的兼容性还不是很好。</p>
<p>贴出代码：</p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;&lt;a href=&quot;http://www.w3.org/TR/html4/loose.dtd%22&quot;&gt;http://www.w3.org/TR/html4/loose.dtd&quot;&lt;/a&gt;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
&lt;title&gt;前端试题(html3/4)&lt;/title&gt;
&lt;style type=&quot;text/css&quot;&gt;
   html, body {height:100%;width:100%;margin:0;overflow:hidden;}
   #fullDiv {width:100%;height:100%;top:0px;left:0px;position:absolute;background:#eee;border:1px solid red;}
   #body {width:100%;height:100%;overflow:auto;z-index:999;position:absolute;top:0px;left:0px;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;input type=&quot;background:red;position:absolute;left:100px;&quot;&gt;&lt;/input&gt;
&lt;!--div的高宽等于浏览器可见区域的高宽，浏览器滚动，div始终覆盖浏览器的整个可见区域--&gt;
&lt;!--input type=&quot;text&quot; style=&quot;background:red;&quot;/--&gt;
&lt;div id=&quot;fullDiv&quot;&gt;&lt;/div&gt;
&lt;div id=&quot;body&quot;&gt;
&lt;div style=&quot;height:1000px;border:1px solid black;background:#ee0;position:absolute;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
   function getBrowerSize() {
      if(document.compatMode == &quot;BackCompat&quot;){
         cWidth = document.body.scrollWidth;
         cHeight = document.body.scrollHeight;
      }
      else {
         cWidth = document.documentElement.scrollWidth;
         cHeight = document.documentElement.scrollHeight;
      }
      return {width:(cWidth-21)+&quot;px&quot;, height:(cHeight - 4)+&quot;px&quot;};
   }
   var floatDiv = document.getElementById('fullDiv');
   var size = getBrowerSize();
   alert(&quot;width:&quot;+size.width+&quot; height:&quot;+size.height);
   floatDiv.style.height = size.height;
   floatDiv.style.width = size.width;
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p><strong>3，IE、FF下面CSS的解释区别</strong></p>
<p>（1） 让页面元素居中</p>
<blockquote><p>ff{margin-left:0px;margin-right:0px;width:***}</p></blockquote>
<blockquote><p>ie上面的设置+text-align:center</p></blockquote>
<p>（2） ff：不支持滤镜</p>
<blockquote><p>ie：支持滤镜</p></blockquote>
<p>（3） ff：支持!important</p>
<p>ie支持*，ie6支持_</p>
<p>（4） min-width,min-height</p>
<blockquote><p>FF支持，IE不支持，IE可以用css expression来替代</p></blockquote>
<p>（5） Css Expression</p>
<blockquote><p>FF不支持，IE支持</p></blockquote>
<p>（6） cursor：hand</p>
<blockquote><p>IE下可以显示手指状，FF下不行</p></blockquote>
<p>（7） UL的默认padding和margin</p>
<blockquote><p>IE下ul默认有margin，FF下ul默认有padding</p></blockquote>
<p>（8） FORM的默认margin</p>
<blockquote><p>IE下FORM有默认margin，FF下margin默认为0</p></blockquote>
<p><strong>4，一个定宽元素在浏览器（IE6，IE7，Firefox）中横向居中对齐的布局，请写出主要的HTML标签及CSS</strong></p>
<p>思路：</p>
<p>IE6/7：text-align:center</p>
<p>Firefox：margin:0 auto(margin-top和margin-bottom也可以为其他数字，关键是margin-left,margin-right为auto)</p>
<p>贴出代码：</p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;&lt;a href=&quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;http://www.w3.org/TR/html4/loose.dtd&lt;/a&gt;&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;/&gt;
&lt;title&gt;让页面元素居中（兼容各个浏览器）&lt;/title&gt;
&lt;style&gt;
html,body{width:100%;height:100%;margin:0px;padding:0px;}
.centerAlign {margin-left:auto;margin-right:auto;text-align:center;width:400px;height:100px;border:1px solid red;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;this div will be centerd!&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p><strong>5，CSS中margin和padding的区别</strong></p>
<p>margin是元素的外边框，是元素边框和相邻元素的距离</p>
<p>Padding是元素的内边框，是元素边框和子元素的距离</p>
<p><strong>6，最后一个问题是，如何制作一个combo选项，就是可以输入可以下拉菜单选择。</strong></p>
<p>思路：</p>
<p>（1）布局select和input，让input覆盖select，除了select的下拉图标，以方便select选择</p>
<p>（2）编写JS，为select添加onchange事件，onchange时将input的value置成select选中的指</p>
<p>贴出代码</p>
<pre class="brush: xml; title: ; notranslate">&lt;HTML&gt;
&lt;HEAD&gt;
&lt;META http-equiv='Content-Type' content='text/html; charset=utf-8'&gt;
&lt;TITLE&gt;可输入的下拉框&lt;/TITLE&gt;
&lt;style type=&quot;text/css&quot;&gt;
    .container {position:relative;margin:10px;}
    .container .sel {width:120px;}
    .container .input {width:100px;height:20px;position:absolute;}
&lt;/style&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;div&gt;
    &lt;input type=&quot;text&quot; id=&quot;input&quot;&gt;&lt;/input&gt;
    &lt;select id=&quot;sel&quot;&gt;
        &lt;option value=&quot;选项1&quot;&gt;选项1&lt;/option&gt;
        &lt;option value=&quot;选项2&quot;&gt;选项2&lt;/option&gt;
        &lt;option value=&quot;选项3&quot;&gt;选项3&lt;/option&gt;
        &lt;option value=&quot;选项4&quot;&gt;选项4&lt;/option&gt;
    &lt;/select&gt;

&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
    var sel = document.getElementById(&quot;sel&quot;);
    var input = document.getElementById(&quot;input&quot;);
    sel.onchange = function() {
        input.value = this.value;
    }
&lt;/script&gt;
&lt;/BODY&gt;&lt;/HTML&gt;</pre>
<p><strong>7，&lt;img&gt;中alt和tittle的区别</strong></p>
<p>alt：图片显示不出来了就提示alt</p>
<p>title：鼠标划过图片显示的提示</p>
<p><strong>8，用css、html编写一个两列布局的网页，要求右侧宽度为200px，左侧自动扩展。</strong></p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot; /&gt;
&lt;title&gt;双列布局，右侧定宽&lt;/title&gt;
&lt;style&gt;
   html,body{width:100%;height:100%;margin:0px;padding:0px;}
   #left {background:#F00; width:100%;position:absolute;padding-right:-200px;}
   #right {background:#0F0; width:200px;position:absolute;right:0px;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;div id=&quot;left&quot;&gt;&lt;/div&gt;
   &lt;div id=&quot;right&quot;&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p><strong>9，解释document.getElementById(“ElementID”).style.fontSize=”1.5em”</strong></p>
<p>em是相对长度单位，相当于当前对象内文本的字体尺寸，如果当前行内文本的字体尺寸未被指定，则相对于浏览器的默认字体尺寸。</p>
<p>该语句将id为ElementID的元素的字体设置为当前对象内文本的字体尺寸的1.5倍</p>
<p><strong>10，Doctype? 严格模式与混杂模式-如何触发这两种模式，区分它们有何意义? 行内元素有哪些？块级元素有哪些？CSS的盒模型？</strong></p>
<p>DOCTYPE是文档类型，用来说明使用的HTML或者XHTML是什么版本，其中的DTD叫文档类型定义，里面包含了文档规则，浏览器根据定义的DTD来解析页面的标识并展现出来</p>
<p>DOCTYPE有两种用途：一个可以进行页面的有效性验证，另一个可以区分浏览器使用严格模式还是混杂模式来解析CSS。</p>
<p>严格模式和混杂模式是浏览器解析CSS的两种模式，目前使用的大部分浏览器对这两种模式都支持，但是IE5只支持混杂模式。</p>
<p>可那个过DOCTYPE声明来判断哪种模式被触发</p>
<p>（1） 没有DOCTYPE声明的网页采用混杂模式解析</p>
<p>（2） 对使用DOCTYPE声明的网页视不同浏览器进行解析</p>
<p>（3） 对于浏览器不能识别的DOCTYPE声明，浏览器采用严格模式解析</p>
<p>（4） 在ie6下，如果在DOCTYPE声明之前有一个xml声明比如</p>
<p>&lt;?xml version=”1.0” encoding=”utf-8”?&gt;，采用混杂模式解析，在IE7，IE8中这条规则不生效。</p>
<p>(5) 在ie下，如果DOCTYPE之前有任何字符，都会导致它进入混杂模式，如：</p>
<pre>&lt;!-- STATUS OK --&gt;</pre>
<p>区分这两种模式可以理解浏览器解析CSS的区别，主要是在盒模式的解释上。</p>
<p><img src="http://witmax.cn/img/web-dev-test-html-1.png" alt="" /><br />
<img src="http://witmax.cn/img/web-dev-test-html-2.png" alt="" /></p>
<p>常见的块级元素有：DIV,FORM,TABLE,P,PRE,H1~H6,DL,OL,UL等</p>
<p>常见的内联元素：SPAN,A,STRONG,EM,LABEL,INPUT,SELECT,TEXTAREA,IMG,BR等<br />
CSS盒模型用于描述为一个HTML元素形成的矩形盒子，盒模型还涉及元素的外边距，内边距，边框和内容，具体来讲最里面的内容是元素内容，直接包围元素内容的是内边距，包围内边距的是边框，包围边框的是外边距。内边距，外边距，边框默认为0。</p>
<p><strong>11，CSS引入的方式有哪些? link和@import的区别?</strong></p>
<p>引入css的方式有下面四种</p>
<p>（1） 使用style属性</p>
<p>（2） 使用style标签</p>
<p>（3） 使用link标签</p>
<p>（4） 使用@import引入</p>
<p>Link和@import区别：</p>
<p>（1） link属于XHTML标签，@import是CSS提供的一种方式。Link除了加载CSS外，还可以做很多事情，如定义RSS，rel连接属性等；@import只能加载CSS</p>
<p>（2） 加载顺序不同，当页面被加载的时候，link加载的CSS随之加载，而@import引用的CSS会等到页面完全下载完之后才会加载</p>
<p>（3） 兼容性差别，由于@import是CSS2.1提出的，所以老的浏览器不支持，IE系列的浏览器IE5以上才能识别，而link没有这个问题</p>
<p>使用DOM控制样式的差别，使用JavaScript控制DOM去改变样式的时候，只能操作link，@import不可以被DOM操作。</p>
<p><strong>12，如何居中一个浮动元素?</strong></p>
<p>一个浮动元素里面包含的元素可以水平居中，原理如下：</p>
<p>让浮动元素left相对于父元素container右移50%，浮动元素left的子元素left-child相对于left左移50%就可以实现left-child相对于container水平居中</p>
<p>垂直居中类似，不过操作的不是left而是top</p>
<p>贴出代码：</p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;/&gt;
&lt;title&gt;让浮动元素居中&lt;/title&gt;
&lt;style&gt;
html,body {width:100%;height:100%;margin:0px;padding:0px;overflow:hidden;}
.container {width:100%;height:100%;position:relative;}
.left {width:400px;height:400px;background:#00F;float:left;position:relative;left:50%;top:50%;}
.left div {position:relative;left:-50%;top:-50%;background:#F00;width:100%;height:100%;}
.clear {clear:both;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div&gt;
&lt;div&gt;&lt;div&gt;这是一个浮动的元素&lt;/div&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p><strong>13，HTML5和CSS3的了解情况</strong></p>
<p>有所了解</p>
<p>HTML5和CSS3分别是新推出的HTML和CSS规范，前世是XHTML2和CSS2，目前还在草案阶段，不过得到了Apple，Opera，Mozilla，Google，Microsoft不同程度的支持，也开发出了不少基于他们的应用。</p>
<p>HTML5相对于原来的HTML规范有一些变化：</p>
<p>（1）DOCTYPE更简洁</p>
<p>（2）新增了一些语义化标签，如article,header,footer,dialog等</p>
<p>（3）新增了一些高级标签，如&lt;vedio&gt;,&lt;audio&gt;,&lt;canvas&gt;</p>
<p>CSS3相对于CSS2也新增了不少功能</p>
<p>（1） 选择器更加丰富</p>
<p>（2） 支持为元素设置阴影</p>
<p>（3） 无需图片能提供圆角</p>
<p><strong>14，你怎么来实现下面这个设计图</strong></p>
<p><img src="http://witmax.cn/img/web-dev-test-html-3.png" alt="" /></p>
<p>（1） 切图</p>
<p>（2） 布局，采用两栏布局，分别左浮动</p>
<p>（3） 编写css代码</p>
<p>贴出代码：</p>
<div>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;&lt;a href=&quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;http://www.w3.org/TR/html4/loose.dtd&lt;/a&gt;&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;/&gt;
&lt;title&gt;品致页面制作&lt;/title&gt;
&lt;style&gt;
html,body {width:100%;height:100%;margin:0px;padding:0px;overflow:hidden;}
ul,li,span,div,img{padding:0px;margin:0px;}
li {list-style:none;margin:0px;padding:0px;}
.wrapper {}
.fl {float:left;}
.nav {width:90px;}
.article {width:270px;padding-left:10px;padding-top:8px;}
.title {font-size:12px;color:#3366cc;margin:8px 0px;}
.title span {margin:0px 2px;}
.btn {background:url(img/btn.jpg) no-repeat;width:61px;height:17px;display:block;}
.article-list {font-size:12px;zoom:1;}
.article-list li.tip{background:url(img/title-bg.jpg) 0px 3px no-repeat ;padding-left:15px;list-style:none;color:#000;}
.article-list li.separator{background:url(img/separator.jpg) no-repeat;width:250px;height:3px;margin:4px 0px;display:block;_margin:0px;line-height:3px;_background:url(img/separator.jpg) 0px 5px no-repeat;}
.clear {clear:both;overflow:hidden;height:0px;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;div&gt;
      &lt;div&gt;
         &lt;div&gt;
            &lt;img src=&quot;img/logo.jpg&quot; alt=&quot;logo&quot;/&gt;
         &lt;/div&gt;
         &lt;div align=&quot;center&quot;&gt;
            &lt;span&gt;品&amp;bull;致&lt;/span&gt;
            &lt;span&gt;第11期&lt;/span&gt;
         &lt;/div&gt;
         &lt;div align=&quot;center&quot;&gt;
            &lt;span&gt;&lt;/span&gt;
         &lt;/div&gt;
      &lt;/div&gt;
      &lt;div&gt;
         &lt;ul&gt;
            &lt;li&gt;老虎伍兹为何被女人“吃掉”？&lt;/li&gt;
            &lt;li&gt;&lt;/li&gt;
            &lt;li&gt;你必须告诉一声的九件事&lt;/li&gt;
            &lt;li&gt;&lt;/li&gt;
            &lt;li&gt;男人，被时尚抛弃的一群？&lt;/li&gt;
            &lt;li&gt;&lt;/li&gt;
            &lt;li&gt;30天牛奶养生让你焕发青春肌肤&lt;/li&gt;
            &lt;li&gt;&lt;/li&gt;
            &lt;li&gt;你是否曾经关注过你的心脏？&lt;/li&gt;
            &lt;li&gt;&lt;/li&gt;
         &lt;/ul&gt;
      &lt;/div&gt;
      &lt;div&gt;&lt;/div&gt;
   &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p><strong>15，css 中id和class如何定义,哪个定义的优先级别高?</strong></p>
</div>
<p>id：#***，***为HTML中定义的id属性</p>
<p>class:.***，***为HTML中定义的class属性</p>
<p>id比class的优先级高</p>
<p><strong>16，用html实现如下表格(不如嵌套实用表格) </strong></p>
<p>三行三列,其中第一行第一列和第二行第一列合并; 第二行第二列和第二行第三列合并(现场画表)</p>
<p>使用表格嵌套，源码如下：</p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;&lt;a href=&quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;http://www.w3.org/TR/html4/loose.dtd&lt;/a&gt;&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;/&gt;
&lt;title&gt;品致页面制作&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
   &lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;1&quot; style=&quot;width:500px;text-align:center;&quot;&gt;
      &lt;tr&gt;
         &lt;td width=&quot;33%&quot;&gt;1&lt;/td&gt;
         &lt;td colspan=&quot;2&quot;&gt;
               &lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; style=&quot;width:100%;text-align:center;&quot; border=&quot;1&quot;&gt;
                  &lt;tr&gt;
                     &lt;td width=&quot;55%&quot;&gt;2&lt;/td&gt;
                     &lt;td&gt;3&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                     &lt;td colspan=&quot;2&quot;&gt;4&lt;/td&gt;
                  &lt;/tr&gt;
               &lt;/table&gt;
         &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
         &lt;td width=&quot;33%&quot;&gt;5&lt;/td&gt;
         &lt;td width=&quot;33%&quot;&gt;6&lt;/td&gt;
         &lt;td&gt;7&lt;/td&gt;
      &lt;/tr&gt;
   &lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<p>运行结果如下：</p>
<p><img src="http://witmax.cn/img/web-dev-test-html-4.png" alt="" /></p>
<p><strong>17，web标准网站有那些优点</strong></p>
<p>（1） Web标准网站结构和布局分离，使网站的访问和维护更加容易</p>
<p>（2） Web标准网站结构，布局以及页面访问都标准化，使网站能在更多的web标准设备中访问，兼容性更好</p>
<p>（3） Web标准网站语义化更好，语义化的XHTML不仅对用户友好，对搜索引擎也友好。</p>
<p>来源：http://www.xuchen.name/2010/10/18/HTML,CSS,笔试题.html 修改了个别错误</p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/web-dev-test-html.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>【CSS】组装图标</title>
		<link>http://witmax.cn/css-assembled-icon.html</link>
		<comments>http://witmax.cn/css-assembled-icon.html#comments</comments>
		<pubDate>Fri, 12 Feb 2010 12:34:37 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[图标]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=707</guid>
		<description><![CDATA[一般情况下，图标总是事先做成图片然后直接拿来调用就行了。但是碰到一个状况需要做3分比例饼图，采用3种颜色标识不同内容在总体所占的比例，简单起见，所占比例为1/8的倍数。效果如下： 这样把每一个比例单独做个图，未免工作量过大，没算错的话需要做45个图；当然你可能会想到用程序去生成图，但也要会图像编程才行，这里先不考虑。 我的方法是把图分解，做一张灰圆，然后分别做8个不同8分比例的浅蓝、深蓝扇形，这个做起来还是比较方便的。做好后利用雪碧工具把图拼合成一张，如下： 利用gif图片的透明性进行CSS组装，如下 &#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.1//EN&#34; &#34;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&#34;&#62; &#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34; &#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=UTF-8&#34; /&#62; &#60;title&#62;CSS组装图标&#60;/title&#62; &#60;/head&#62; &#60;body&#62; &#60;style&#62; .icon{ width:16px; height:16px; background:url(http://witmax.cn/img/css-original-icon.gif) no-repeat -256px 0px; display: inline-block; } .icon span, .icon span span{ width:16px; height:16px; background-repeat:no-repeat; background-image:url(http://witmax.cn/img/css-original-icon.gif); display: inline-block; } .b1 { background-position:0px 0px; } .b2 { background-position:-16px 0px; [...]]]></description>
			<content:encoded><![CDATA[<p>一般情况下，图标总是事先做成图片然后直接拿来调用就行了。但是碰到一个状况需要做3分比例饼图，采用3种颜色标识不同内容在总体所占的比例，简单起见，所占比例为1/8的倍数。效果如下：</p>
<p><a href="http://witmax.cn/img/css-assembled-icon.png" rel="lightbox[707]" title="组装图标效果"><img class="alignnone" title="组装图标效果" src="http://witmax.cn/img/css-assembled-icon.png" alt="组装图标效果" width="23" height="23" /></a></p>
<p>这样把每一个比例单独做个图，未免工作量过大，没算错的话需要做45个图；当然你可能会想到用程序去生成图，但也要会图像编程才行，这里先不考虑。</p>
<p><span id="more-707"></span></p>
<p>我的方法是把图分解，做一张灰圆，然后分别做8个不同8分比例的浅蓝、深蓝扇形，这个做起来还是比较方便的。做好后利用雪碧工具把图拼合成一张，如下：</p>
<p><a href="http://witmax.cn/img/css-original-icon.gif" rel="lightbox[707]" title="原始图标"><img class="alignnone" title="原始图标" src="http://witmax.cn/img/css-original-icon.gif" alt="原始图标" width="272" height="16" /></a></p>
<p>利用gif图片的透明性进行CSS组装，如下</p>
<div class="runcode">
<p><textarea name="runcode" style="height:280px;width:540px;font-size:12px" class="runcode_text" id="runcode_6ngvTb"> &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.1//EN&quot; &quot;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
&lt;title&gt;CSS组装图标&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;style&gt;
.icon{ width:16px; height:16px; background:url(http://witmax.cn/img/css-original-icon.gif) no-repeat -256px 0px; display: inline-block; }
    .icon span, .icon span span{ width:16px; height:16px; background-repeat:no-repeat; background-image:url(http://witmax.cn/img/css-original-icon.gif); display: inline-block; }
    .b1 { background-position:0px 0px; }
    .b2 { background-position:-16px 0px; }
    .b3 { background-position:-32px 0px; }
    .b4 { background-position:-48px 0px; }
    .b5 { background-position:-64px 0px; }
    .b6 { background-position:-80px 0px; }
    .b7 { background-position:-96px 0px; }
    .b8 { background-position:-112px 0px; }
    .d1 { background-position:-128px 0px; }
    .d2 { background-position:-144px 0px; }
    .d3 { background-position:-160px 0px; }
    .d4 { background-position:-176px 0px; }
    .d5 { background-position:-192px 0px; }
    .d6 { background-position:-208px 0px; }
    .d7 { background-position:-224px 0px; }
    .d8 { background-position:-250px 0px; }
&lt;/style&gt;
&lt;span class=&quot;icon&quot;&gt;&lt;span class=&quot;b6&quot;&gt;&lt;span class=&quot;d3&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;3:3:2&lt;br /&gt;
&lt;span class=&quot;icon&quot;&gt;&lt;span class=&quot;b4&quot;&gt;&lt;span class=&quot;d2&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;2:2:4&lt;br /&gt;
&lt;span class=&quot;icon&quot;&gt;&lt;span class=&quot;b7&quot;&gt;&lt;span class=&quot;d4&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;4:3:1&lt;br /&gt;
&lt;a href=&quot;http://witmax.cn&quot; target=&quot;_blank&quot;&gt;晴枫&lt;/a&gt;制作
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_6ngvTb');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_6ngvTb');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_6ngvTb','runcode_6ngvTb');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>源码下载：<a class="downloadlink" href="http://witmax.cn/downloads/24" title="版本：v1.0 已下载274次" target="_blank">CSS拼装图标源码</a></p>
<p>参考文章： Tencent ISD Webteam《<a href="http://webteam.tencent.com/?p=1330">由黄钻等级图标处理引发的思考</a>》</p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/css-assembled-icon.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【CSS】用css控制cellspacing、cellpadding分析</title>
		<link>http://witmax.cn/css-control-cellspacing-cellpadding.html</link>
		<comments>http://witmax.cn/css-control-cellspacing-cellpadding.html#comments</comments>
		<pubDate>Sun, 20 Dec 2009 16:09:36 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=607</guid>
		<description><![CDATA[默认情况下，table单元格之间是有间隔的。一般情况下，我们会利用table的cellpadding和cellpadding来清除默认样式，如下： 但这样做不仅增加了代码的体积，而且也极其不符合样式与内容分离的web标准，因此使用css控制cellspacing/cellpadding便有其意义。 先说结论，采用以下两行样式即可： th, td{padding:0;}效果等同于cellpadding=”0&#8243;。 table {border-collapse:collapse;}效果类似cellspacing=”0&#8243;。为何是类似呢？因为前者是连同边框border一同去掉了，可参见下面的例子。与cellspacing=”0&#8243;等同的应该是table{border-spacing:0;}，但是IE6不支持，所以还是用border-collapse。 做了一个测试页面，直观看效果可能更容易理解： &#60;!DOCTYPE HTML PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html&#62;&#60;head&#62; &#60;title&#62;枫芸志 &#38;raquo; 表格边框间隔&#60;/title&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=UTF-8&#34;&#62; &#60;style type=&#34;text/css&#34;&#62; &#60;!-- td { background-color:#9900CC; border:1px #000 solid;} table { border:1px #f00 solid; margin:5px;} .A { border-collapse:collapse; } .B { border-spacing:0; } .C tr td { padding:0px; } --&#62; &#60;/style&#62; &#60;/head&#62;&#60;body&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>默认情况下，table单元格之间是有间隔的。一般情况下，我们会利用table的cellpadding和cellpadding来清除默认样式，如下：</p>
<pre class="brush: xml; title: ; notranslate">&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;&lt;/table&gt;</pre>
<p>但这样做不仅增加了代码的体积，而且也极其不符合样式与内容分离的web标准，因此使用css控制cellspacing/cellpadding便有其意义。</p>
<p><span id="more-607"></span></p>
<p>先说结论，采用以下两行样式即可：</p>
<pre class="brush: css; title: ; notranslate">table{border-collapse:collapse;}
th,td{padding:0;}</pre>
<p>th, td{padding:0;}效果等同于cellpadding=”0&#8243;。</p>
<p>table {border-collapse:collapse;}效果类似cellspacing=”0&#8243;。为何是类似呢？因为前者是连同边框border一同去掉了，可参见下面的例子。与cellspacing=”0&#8243;等同的应该是table{border-spacing:0;}，但是IE6不支持，所以还是用border-collapse。</p>
<p>做了一个测试页面，直观看效果可能更容易理解：</p>
<div class="runcode">
<p><textarea name="runcode" style="height:280px;width:540px;font-size:12px" class="runcode_text" id="runcode_W1LL9Q"> &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;
&lt;title&gt;枫芸志 &amp;raquo; 表格边框间隔&lt;/title&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;!--
td { background-color:#9900CC; border:1px #000 solid;}
table { border:1px #f00 solid; margin:5px;}
.A { border-collapse:collapse; }
.B { border-spacing:0; }
.C tr td { padding:0px; }
--&gt;
&lt;/style&gt;
&lt;/head&gt;&lt;body&gt;

&lt;h2&gt;表格边框间隔&lt;/h2&gt;
&lt;pre&gt;
td { background-color:#9900CC; border:1px #000 solid;}
table { border:1px #f00 solid; margin:5px;}
.A { border-collapse:collapse; }
.B { border-spacing:0; }
.C tr td { padding:0px; }
&lt;/pre&gt;
&lt;table&gt;&lt;tr&gt;&lt;td&gt;aaaaaaaaaaa&lt;/td&gt;&lt;td&gt;b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;c&lt;/td&gt;&lt;td&gt;d&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
默认无样式
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tr&gt;&lt;td&gt;aaaaaaaaaaa&lt;/td&gt;&lt;td&gt;b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;c&lt;/td&gt;&lt;td&gt;d&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
采用cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;
&lt;table class=&quot;A&quot;&gt;&lt;tr&gt;&lt;td&gt;aaaaaaaaaaa&lt;/td&gt;&lt;td&gt;b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;c&lt;/td&gt;&lt;td&gt;d&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
样式A
&lt;table class=&quot;B&quot;&gt;&lt;tr&gt;&lt;td&gt;aaaaaaaaaaa&lt;/td&gt;&lt;td&gt;b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;c&lt;/td&gt;&lt;td&gt;d&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
样式B
&lt;table class=&quot;C&quot;&gt;&lt;tr&gt;&lt;td&gt;aaaaaaaaaaa&lt;/td&gt;&lt;td&gt;b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;c&lt;/td&gt;&lt;td&gt;d&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
样式C
&lt;table class=&quot;A B&quot;&gt;&lt;tr&gt;&lt;td&gt;aaaaaaaaaaa&lt;/td&gt;&lt;td&gt;b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;c&lt;/td&gt;&lt;td&gt;d&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
样式A、B
&lt;table class=&quot;A C&quot;&gt;&lt;tr&gt;&lt;td&gt;aaaaaaaaaaa&lt;/td&gt;&lt;td&gt;b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;c&lt;/td&gt;&lt;td&gt;d&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
样式A、C
&lt;table class=&quot;B C&quot;&gt;&lt;tr&gt;&lt;td&gt;aaaaaaaaaaa&lt;/td&gt;&lt;td&gt;b&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;c&lt;/td&gt;&lt;td&gt;d&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
样式B、C
&lt;p&gt;除IE6不支持样式B外其他样式在主流浏览器中皆有效。&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://witmax.cn&quot;&gt;枫芸志&lt;/a&gt;&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_W1LL9Q');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_W1LL9Q');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_W1LL9Q','runcode_W1LL9Q');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>以下是border-collapse属性和border-spacing属性介绍，至于padding属性同其他的盒状模型。</p>
<p><strong>border-collapse属性</strong></p>
<p>用法：设置或检索表格的行和单元格的边是合并在一起还是按照标准的HTML样式分开。</p>
<table border="0">
<tbody>
<tr>
<th style="width: 30%;">默认值：</th>
<td style="width: 70%;">separate</td>
</tr>
<tr>
<th>继承性：</th>
<td>yes</td>
</tr>
<tr>
<th>版本：</th>
<td>CSS2</td>
</tr>
<tr>
<th>JavaScript 语法：</th>
<td><em>object</em>.style.borderCollapse=”collapse”</td>
</tr>
</tbody>
</table>
<p>浏览器支持：所有主流浏览器都支持 border-collapse 属性。<span>说明：</span>任何的版本的 Internet Explorer （包括 IE8）都不支持属性值 “inherit”。</p>
<table border="0">
<tbody>
<tr>
<th>值</th>
<th>描述</th>
</tr>
<tr>
<td>separate</td>
<td>默认值。边框会被分开。不会忽略 border-spacing 和 empty-cells 属性。</td>
</tr>
<tr>
<td>collapse</td>
<td>如果可能，边框会合并为一个单一的边框。会忽略 border-spacing 和 empty-cells 属性。</td>
</tr>
<tr>
<td>inherit</td>
<td>规定应该从父元素继承 border-collapse 属性的值。</td>
</tr>
</tbody>
</table>
<p><strong>border-spacing 属性</strong></p>
<p>用法：设置相邻单元格的边框间的距离（仅用于“边框分离”模式）。 该属性指定分隔边框模型中单元格边界之间的距离。在指定的两个长度值中，第一个是水平间隔，第二个是垂直间隔。除非 border-collapse 被设置为 separate，否则将忽略这个属性。尽管这个属性只应用于表，不过它可以由表中的所有元素继承。</p>
<table border="0">
<tbody>
<tr>
<th style="width: 25%;">默认值：</th>
<td style="width: 75%;"><em>not specified</em></td>
</tr>
<tr>
<th>继承性：</th>
<td>yes</td>
</tr>
<tr>
<th>版本：</th>
<td>CSS2</td>
</tr>
<tr>
<th>JavaScript 语法：</th>
<td><em>object</em>.style.borderSpacing=”15px”</td>
</tr>
</tbody>
</table>
<p>浏览器支持：所有主流浏览器除了IE6都支持 border-spacing 属性。</p>
<table border="0">
<tbody>
<tr>
<th>值</th>
<th>描述</th>
</tr>
<tr>
<td><em>length length</em></td>
<td>规定相邻单元的边框之间的距离。使用 px、cm 等单位。不允许使用负值。如果定义一个 <em>length</em> 参数，那么定义的是水平和垂直间距。如果定义两个 <em>length</em> 参数，那么第一个设置水平间距，而第二个设置垂直间距。</td>
</tr>
<tr>
<td>inherit</td>
<td>规定应该从父元素继承 border-spacing 属性的值。</td>
</tr>
</tbody>
</table>
<p>更多关于CSS样式属性的解释提供 <a class="downloadlink" href="http://witmax.cn/downloads/16" title="版本：1.0 已下载101次" target="_blank">CSS样式表手册</a> 供大家参考。</p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/css-control-cellspacing-cellpadding.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【CSS】设置div的最小高度（多浏览器兼容）</title>
		<link>http://witmax.cn/css-min-height.html</link>
		<comments>http://witmax.cn/css-min-height.html#comments</comments>
		<pubDate>Fri, 11 Dec 2009 14:47:45 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=598</guid>
		<description><![CDATA[网页布局中会碰到需要某一个div有最小高度，超过最小高度后会自动扩展。比如某个div是有背景图的，高度小了背景图就不完整了影响效果。需要用到css中的min-height属性。 min-height属性的使用说明： 设置或检索对象的最小高度。如果此属性的值大于 max-height 属性的值，将会被自动转设为 max-height 属性的值。在IE6中这个属性仅仅作用于固定布局的表格内的 td 对象， th 对象， tr 对象。表格的默认布局是自动计算的，要得到固定布局的表格，设置表格的 table-layout 属性的值为 fixed 。固定布局的算法比默认的自动算法要快很多。此属性对于 currentStyle 对象而言是只读的。对于其他对象而言是可读写的。 对应的脚本特性为 minHeight 。 最简单的是采用以下css样式： 本来单用min-height就可以高度了，可是可恶的IE6不支持，于是加了后面两行来修正。 上完整的测试代码： &#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html xmlns=&#34;http://www.w3.org/1999/xhtml&#34;&#62; &#60;head&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=gb2312&#34; /&#62; &#60;title&#62;枫芸志 &#38;raquo; CSS设定div最小高度&#60;/title&#62; &#60;style&#62; .min-height { min-height:100px; height:auto !important; height:100px; background-color: #6699ff; width:300px; } [...]]]></description>
			<content:encoded><![CDATA[<p>网页布局中会碰到需要某一个div有最小高度，超过最小高度后会自动扩展。比如某个div是有背景图的，高度小了背景图就不完整了影响效果。需要用到css中的min-height属性。</p>
<p>min-height属性的使用说明：</p>
<blockquote><p>设置或检索对象的最小高度。如果此属性的值大于 max-height 属性的值，将会被自动转设为 max-height 属性的值。在IE6中这个属性仅仅作用于固定布局的表格内的 td 对象， th 对象， tr 对象。表格的默认布局是自动计算的，要得到固定布局的表格，设置表格的 table-layout 属性的值为 fixed 。固定布局的算法比默认的自动算法要快很多。此属性对于 currentStyle 对象而言是只读的。对于其他对象而言是可读写的。 对应的脚本特性为 minHeight 。</p></blockquote>
<p><span id="more-598"></span></p>
<p>最简单的是采用以下css样式：</p>
<pre class="brush: jscript; title: ; notranslate">min-height:100px;
height:auto !important;
height:100px; </pre>
<p>本来单用min-height就可以高度了，可是可恶的IE6不支持，于是加了后面两行来修正。</p>
<p>上完整的测试代码：</p>
<div class="runcode">
<p><textarea name="runcode" style="height:280px;width:540px;font-size:12px" class="runcode_text" id="runcode_YH4ABb"> &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot; /&gt;
&lt;title&gt;枫芸志 &amp;raquo; CSS设定div最小高度&lt;/title&gt;
&lt;style&gt;
.min-height {
    min-height:100px; 
    height:auto !important; 
    height:100px; 
    background-color: #6699ff;
    width:300px;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div class=&quot;min-height&quot;&gt;
&lt;pre&gt;
line
line
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;min-height&quot;&gt;
&lt;pre&gt;
line
line
line
line
line
line
line
line
line
line
line
line
line
&lt;/pre&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_YH4ABb');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_YH4ABb');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_YH4ABb','runcode_YH4ABb');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>以上代码在IE6/IE7/IE8/Firefox/Opera/Chrome/Safari下测试有效。</p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/css-min-height.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【CSS】设置选中文字的颜色和背景色</title>
		<link>http://witmax.cn/css-text-selection.html</link>
		<comments>http://witmax.cn/css-text-selection.html#comments</comments>
		<pubDate>Sun, 06 Dec 2009 10:55:46 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网页设计]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=592</guid>
		<description><![CDATA[在网页上选中一段文字，选中的文字默认情况下是以蓝色背景+ 白色文字来显示的。看过一些网站，修改了选中文字的背景色，感觉十分清新，今天来查了一下怎么实现的。 上DEMO： &#60;!DOCTYPE HTML PUBLIC &#34;-//W3C//DTD XHTML 1.0 Transitional//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#34;&#62; &#60;html&#62;&#60;head&#62; &#60;title&#62;枫芸志 &#38;raquo; 文本选中样式&#60;/title&#62; &#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=UTF-8&#34;&#62; &#60;style type=&#34;text/css&#34;&#62; &#60;!-- ::selection { background:#cc00cc; color:#fff; } ::-moz-selection{ background:#cc00cc; color:#fff; } code::selection { background: #666666; } code::-moz-selection { background: #666666; } span.selected { background:#cc00cc; color:#fff; } --&#62; &#60;/style&#62; &#60;/head&#62;&#60;body&#62; &#60;h2&#62;文本选中样式&#60;/h2&#62; &#60;p&#62;可以给用户选中的文本定义 字体颜色 &#60;code&#62;color&#60;/code&#62; 和 背景颜色 [...]]]></description>
			<content:encoded><![CDATA[<p>在网页上选中一段文字，选中的文字默认情况下是以蓝色背景+ 白色文字来显示的。看过一些网站，修改了选中文字的背景色，感觉十分清新，今天来查了一下怎么实现的。</p>
<p>上DEMO：</p>
<p><span id="more-592"></span></p>
<div class="runcode">
<p><textarea name="runcode" style="height:280px;width:540px;font-size:12px" class="runcode_text" id="runcode_6Z3yQS"> &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;
&lt;title&gt;枫芸志 &amp;raquo; 文本选中样式&lt;/title&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
&lt;!--

::selection {
    background:#cc00cc;
    color:#fff;
}
::-moz-selection{
    background:#cc00cc;
    color:#fff;
}
code::selection {
    background: #666666;
}
code::-moz-selection {
    background: #666666;
}

span.selected {
    background:#cc00cc;
    color:#fff;
}
--&gt;
&lt;/style&gt;
&lt;/head&gt;&lt;body&gt;

&lt;h2&gt;文本选中样式&lt;/h2&gt;

&lt;p&gt;可以给用户选中的文本定义 字体颜色 &lt;code&gt;color&lt;/code&gt; 和 背景颜色 &lt;code&gt;background&lt;/code&gt; 。&lt;/p&gt;

&lt;p&gt;不支持IE浏览器，支持Firefox、Opera、Chrome、Sarari。&lt;/p&gt;

&lt;p&gt;选择本页中的文字查看效果，如果浏览器支持的话会看到&lt;span class=&quot;selected&quot;&gt;这样的效果&lt;/span&gt;&lt;/p&gt;

&lt;h3&gt;测试使用的样式表：&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;::selection {
    background:#cc00cc;
    color:#fff;
}

::-moz-selection{
    background:#cc00cc;
    color:#fff;
}

code::selection {
    background: #666666;
}

code::-moz-selection {
    background: #666666;
}

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Firefox浏览器使用 &lt;code&gt;::-moz-selection&lt;/code&gt; 选择符，其他浏览器皆采用 &lt;code&gt;::selection&lt;/code&gt; 选择符，文本选中样式只支持 &lt;code&gt;color&lt;/code&gt; 和  &lt;code&gt;background&lt;/code&gt; 属性&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://witmax.cn&quot;&gt;枫芸志&lt;/a&gt;&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;</textarea></p>
<p><input type="button" value="运行" class="runcode_button" onclick="runcode_open_new('runcode_6Z3yQS');"/> <input type="button" value="复制" class="runcode_button" onclick="runcode_copy('runcode_6Z3yQS');"/> <input type="button" value="另存代码" class="runcode_button" onclick="saveCode('runcode_6Z3yQS','runcode_6Z3yQS');"/> 提示：你可以先修改部分代码再运行。</p>
</div>
<p>相关CSS样式如下：</p>
<pre class="brush: css; title: ; notranslate">::selection {
 background:#cc00cc;
 color:#fff;
}
::-moz-selection{
 background:#cc00cc;
 color:#fff;
}
code::selection {
 background: #666666;
}
code::-moz-selection {
 background: #666666;
}
</pre>
<p>做几点说明：</p>
<ol>
<li>Firefox使用::-moz-selection私有选择符来实现，不支持::selection选择符</li>
<li>Chrome、Safari、Opera均使用::selection选择符</li>
<li>IE系列不支持选中文本样式</li>
<li>选中文本样式只支持文本颜色color和背景颜色background属性</li>
</ol>
<p><a href="http://witmax.cn/demo/text-selection.html" target="_blank">选中文字样式DEMO</a>在Firfox 3.5、Opera 9.64、Chrome 3、Safari 4上测试有效，IE下无效。</p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/css-text-selection.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TypeTester：在线字体效果对比生成工具</title>
		<link>http://witmax.cn/typetester.html</link>
		<comments>http://witmax.cn/typetester.html#comments</comments>
		<pubDate>Thu, 05 Nov 2009 04:37:44 +0000</pubDate>
		<dc:creator>晴枫</dc:creator>
				<category><![CDATA[网络应用]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[字体]]></category>

		<guid isPermaLink="false">http://witmax.cn/?p=550</guid>
		<description><![CDATA[设计选择字体时往往希望直接对比不同的字体效果来确定哪个字体更合适，而TypeTester就是这样的一个工具，而且能同时生成CSS样式。 TypeTester功能特色： 支持中文字体 三列效果样式、12种字体样式，方便对比效果 允许设置字体、字号、间距、颜色、背景、位置等属性 能生成CSS样式 操作便捷，使用方便 界面如下： 通过设置获得理想的字体效果后，点击Tools中的Get CSS For后的链接，可获取设置的CSS样式，如下图： 复制其中的CSS内容放到自己的CSS样式里即可。 TypeTester网址：http://www.typetester.org/ over :-)]]></description>
			<content:encoded><![CDATA[<p>设计选择字体时往往希望直接对比不同的字体效果来确定哪个字体更合适，而TypeTester就是这样的一个工具，而且能同时生成CSS样式。</p>
<p>TypeTester功能特色：</p>
<ul>
<li>支持中文字体</li>
<li>三列效果样式、12种字体样式，方便对比效果</li>
<li>允许设置字体、字号、间距、颜色、背景、位置等属性</li>
<li>能生成CSS样式</li>
<li>操作便捷，使用方便</li>
</ul>
<p><span id="more-550"></span></p>
<p>界面如下：</p>
<div class="wp-caption aligncenter" style="width: 570px"><a title="TypeTester界面" rel="lightbox[typetester]" href="http://witmax.cn/img/typetester.png"><img title="TypeTester界面" src="http://witmax.cn/img/typetester.png" alt="TypeTester界面" width="560" /></a><p class="wp-caption-text">TypeTester界面</p></div>
<p>通过设置获得理想的字体效果后，点击Tools中的Get CSS For后的链接，可获取设置的CSS样式，如下图：</p>
<div class="wp-caption aligncenter" style="width: 418px"><a title="TypeTester生成CSS样式" rel="lightbox[typetester]" href="http://witmax.cn/img/typetester-2.png"><img title="TypeTester生成CSS样式" src="http://witmax.cn/img/typetester-2.png" alt="TypeTester生成CSS样式" width="408" /></a><p class="wp-caption-text">TypeTester生成CSS样式</p></div>
<p>复制其中的CSS内容放到自己的CSS样式里即可。</p>
<p>TypeTester网址：<a href="http://www.typetester.org/">http://www.typetester.org/</a></p>
<p>over :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://witmax.cn/typetester.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

