<?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>CSS | 酷 壳 - CoolShell</title>
	<atom:link href="https://coolshell.cn/tag/css/feed" rel="self" type="application/rss+xml" />
	<link>https://coolshell.cn</link>
	<description>享受编程和技术所带来的快乐 - Coding Your Ambition</description>
	<lastBuildDate>Thu, 19 Jan 2017 13:23:08 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2</generator>
	<item>
		<title>Chrome开发者工具的小技巧</title>
		<link>https://coolshell.cn/articles/17634.html</link>
					<comments>https://coolshell.cn/articles/17634.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Thu, 19 Jan 2017 12:25:55 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[编程工具]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=17634</guid>

					<description><![CDATA[<p>Chrome的开发者工具是个很强大的东西，相信程序员们都不会陌生，不过有些小功能可能并不为大众所知，所以，写下这篇文章罗列一下可能你所不知道的功能，有的功能可能...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/17634.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/17634.html">Chrome开发者工具的小技巧</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>Chrome的开发者工具是个很强大的东西，相信程序员们都不会陌生，不过有些小功能可能并不为大众所知，所以，写下这篇文章罗列一下可能你所不知道的功能，有的功能可能会比较实用，有的则不一定，也欢迎大家补充交流。</p>
<p>话不多话，我们开始。</p>
<h4>代码格式化</h4>
<p>有很多css/js的代码都会被 minify 掉，你可以点击代码窗口左下角的那个 <strong><code>{ }</code></strong>  标签，chrome会帮你给格式化掉。</p>
<p><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-17640" src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code.gif" alt="" width="707" height="319" /></p>
<p><span id="more-17634"></span></p>
<h4>强制DOM状态</h4>
<p>有些HTML的DOM是有状态的，比如&lt;a&gt; 标签，其会有 active，hover， focus，visited这些状态，有时候，我们的CSS会来定关不同状态的样式，在分析网页查看网页上DOM的CSS样式时，我们可以点击CSS样式上的 <strong><code>:hov</code></strong> 这个小按钮来强制这个DOM的状态。</p>
<p>&nbsp;</p>
<p><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-17641" src="https://coolshell.cn/wp-content/uploads/2017/01/state.gif" alt="" width="853" height="331" /></p>
<p>&nbsp;</p>
<h4>动画</h4>
<p>现在的网页上都会有一些动画效果。在Chrome的开发者工具中，通过右上角的菜单中的 <code>More Tools</code> =&gt; <code>Animations</code> 呼出相关的选项卡。于是你就可以慢动作播放动画了（可以点选 <code>25%</code> 或 <code>10%</code>），然后，Chrome还可以帮你把动画录下来，你可以拉动动再画的过程，甚至可以做一些简单的修改。</p>
<p>&nbsp;</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17637" src="https://coolshell.cn/wp-content/uploads/2017/01/animation.gif" width="442" height="723" /></p>
<h4>直接编辑网页</h4>
<p>在你的 console 里 输入下面的命令：</p>
<p><code data-enlighter-language="js" class="EnlighterJSRAW">document.designMode = &quot;on&quot; </code></p>
<p>于是你就可以直接修改网页上的内容了。</p>
<p>P.S. 下面这个抓屏中还演示了一个如何清空console的示例。你可以输入 clear() 或是 按 <code>Ctrl+L</code>（Windows下），<code>CMD + K</code> (Mac下)</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17642" src="https://coolshell.cn/wp-content/uploads/2017/01/editor.gif" width="800" height="328" /></p>
<p>&nbsp;</p>
<h4>网络限速</h4>
<p>你可以设置你的网络的访问速度来模拟一个网络很慢的情况。</p>
<p><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-17644" src="https://coolshell.cn/wp-content/uploads/2017/01/custom-network-throttling-profiles.gif" alt="" width="707" height="319" /></p>
<p>&nbsp;</p>
<h4>复制HTTP请求</h4>
<p>这个是我很喜欢 的一个功能，你可以在 network选项卡里，点击 XHR 过滤相关的Ajax请求，然后在相关的请求上点鼠标右键，在菜单中选择： <code>Copy</code> =&gt; <code>Copy as cURL</code>，然后就可以到你的命令行下去 执行 <code>curl</code> 的命令了。这个可以很容易做一些自动化的测试。</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17645" src="https://coolshell.cn/wp-content/uploads/2017/01/curl.gif" width="800" height="328" /></p>
<p>&nbsp;</p>
<p><strong>友情提示：这个操作有可能会把你的个人隐私信息复制出去，比如你个人登录后的cookie。</strong></p>
<h4>抓个带手机的图</h4>
<p>这个可能有点无聊了，不过我觉得挺有意思的。</p>
<p>在device显示中，先选择一个手机，然后在右上角选 <code>Show Device Frame</code>，然后你就看到手机的样子了，然后再到那个菜中中选 Capture snapshot，就可以抓下一个有手机样子的截图了。</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17646" src="https://coolshell.cn/wp-content/uploads/2017/01/device.gif" width="700" height="404" /></p>
<p>我抓的图如下（当然，不是所有的手机都有frame的）</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17647 size-medium" src="https://coolshell.cn/wp-content/uploads/2017/01/coolshell.cn-iPhone-6-Plus-1-148x300.png" width="148" height="300" srcset="https://coolshell.cn/wp-content/uploads/2017/01/coolshell.cn-iPhone-6-Plus-1-148x300.png 148w, https://coolshell.cn/wp-content/uploads/2017/01/coolshell.cn-iPhone-6-Plus-1-768x1559.png 768w, https://coolshell.cn/wp-content/uploads/2017/01/coolshell.cn-iPhone-6-Plus-1-505x1024.png 505w, https://coolshell.cn/wp-content/uploads/2017/01/coolshell.cn-iPhone-6-Plus-1-133x270.png 133w, https://coolshell.cn/wp-content/uploads/2017/01/coolshell.cn-iPhone-6-Plus-1.png 780w" sizes="(max-width: 148px) 100vw, 148px" /></p>
<p>&nbsp;</p>
<h4>设置断点</h4>
<p>除了给Javascript的源代码上设置断点调试，你还可以：</p>
<h5>给DOM设置断点</h5>
<p>选中一个DOM，然后在右键菜单中选 Break on &#8230; 你可以看到如下三个选项：</p>
<h4><img decoding="async" loading="lazy" class="aligncenter wp-image-17665" src="https://coolshell.cn/wp-content/uploads/2017/01/break.dom_-1024x708.png" width="500" height="345" srcset="https://coolshell.cn/wp-content/uploads/2017/01/break.dom_-1024x708.png 1024w, https://coolshell.cn/wp-content/uploads/2017/01/break.dom_-300x207.png 300w, https://coolshell.cn/wp-content/uploads/2017/01/break.dom_-768x531.png 768w, https://coolshell.cn/wp-content/uploads/2017/01/break.dom_-391x270.png 391w, https://coolshell.cn/wp-content/uploads/2017/01/break.dom_.png 1152w" sizes="(max-width: 500px) 100vw, 500px" /></h4>
<h5>给XHR和Event Lisener设置断点</h5>
<p>在 Sources 面页中，你可以看到右边的那堆break points中，除了上面我们说的给DOM设置断点，你还可以给XHR和Event Listener设置断点，载图如下：</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17666" src="https://coolshell.cn/wp-content/uploads/2017/01/breakpoints-834x1024.png" width="400" height="491" srcset="https://coolshell.cn/wp-content/uploads/2017/01/breakpoints-834x1024.png 834w, https://coolshell.cn/wp-content/uploads/2017/01/breakpoints-244x300.png 244w, https://coolshell.cn/wp-content/uploads/2017/01/breakpoints-768x943.png 768w, https://coolshell.cn/wp-content/uploads/2017/01/breakpoints-220x270.png 220w, https://coolshell.cn/wp-content/uploads/2017/01/breakpoints.png 906w" sizes="(max-width: 400px) 100vw, 400px" /></p>
<h4>关于Console中的技巧</h4>
<h5>DOM操作</h5>
<ul>
<li>chrome会帮你buffer 5个你查看过的DOM对象，你可以直接在Console中用 $0, $1, $2, $3, $4来访问。</li>
</ul>
<ul>
<li>你还可以使用像jQuery那样的语法来获得DOM对象，如：<code>$("#mydiv")</code></li>
</ul>
<ul>
<li>你还可使用 <code>$$(".class")</code> 来选择所有满足条件的DOM对象。</li>
</ul>
<ul>
<li>你可以使用 <code>getEventListeners($("selector"))</code> 来查看某个DOM对象上的事件（如下图所示）。</li>
</ul>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17656" src="https://coolshell.cn/wp-content/uploads/2017/01/events-geteventlisteners_expanded.png" width="642" height="223" srcset="https://coolshell.cn/wp-content/uploads/2017/01/events-geteventlisteners_expanded.png 842w, https://coolshell.cn/wp-content/uploads/2017/01/events-geteventlisteners_expanded-300x104.png 300w, https://coolshell.cn/wp-content/uploads/2017/01/events-geteventlisteners_expanded-768x267.png 768w, https://coolshell.cn/wp-content/uploads/2017/01/events-geteventlisteners_expanded-604x210.png 604w" sizes="(max-width: 642px) 100vw, 642px" /></p>
<ul>
<li>你还可以使用 <code>monitorEvents($("selector"))</code> 来监控相关的事件。比如：</li>
</ul>
<p><code data-enlighter-language="js" class="EnlighterJSRAW">monitorEvents(document.body, &quot;click&quot;);</code></p>
<p><img decoding="async" loading="lazy" class="aligncenter size-large wp-image-17661" src="https://coolshell.cn/wp-content/uploads/2017/01/monitor-events-1024x378.png" alt="" width="640" height="236" srcset="https://coolshell.cn/wp-content/uploads/2017/01/monitor-events-1024x378.png 1024w, https://coolshell.cn/wp-content/uploads/2017/01/monitor-events-300x111.png 300w, https://coolshell.cn/wp-content/uploads/2017/01/monitor-events-768x283.png 768w, https://coolshell.cn/wp-content/uploads/2017/01/monitor-events-604x223.png 604w, https://coolshell.cn/wp-content/uploads/2017/01/monitor-events.png 1302w" sizes="(max-width: 640px) 100vw, 640px" /></p>
<h5>Console中的一些函数</h5>
<p><strong>1）monitor函数</strong></p>
<p>使用 monitor函数来监控一函数，如下面的示例</p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17657 size-medium" src="https://coolshell.cn/wp-content/uploads/2017/01/monitor-300x112.png" width="300" height="112" srcset="https://coolshell.cn/wp-content/uploads/2017/01/monitor-300x112.png 300w, https://coolshell.cn/wp-content/uploads/2017/01/monitor-604x226.png 604w, https://coolshell.cn/wp-content/uploads/2017/01/monitor.png 706w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p><strong>2）copy函数</strong></p>
<p>copy函数可以把一个变量的值copy到剪贴板上。</p>
<p><strong>3）inspect函数</strong></p>
<p>inspect函数可以让你控制台跳到你需要查看的对象上。如：</p>
<p><img decoding="async" loading="lazy" class="aligncenter size-large wp-image-17662" src="https://coolshell.cn/wp-content/uploads/2017/01/inspect-1024x459.png" alt="" width="640" height="287" srcset="https://coolshell.cn/wp-content/uploads/2017/01/inspect-1024x459.png 1024w, https://coolshell.cn/wp-content/uploads/2017/01/inspect-300x135.png 300w, https://coolshell.cn/wp-content/uploads/2017/01/inspect-768x345.png 768w, https://coolshell.cn/wp-content/uploads/2017/01/inspect-602x270.png 602w, https://coolshell.cn/wp-content/uploads/2017/01/inspect.png 1364w" sizes="(max-width: 640px) 100vw, 640px" /></p>
<p>更多的函数请参数官方文档 &#8211; <a href="https://developers.google.com/web/tools/chrome-devtools/console/command-line-reference" target="_blank">Using the Console / Command Line Reference</a></p>
<h5>Console的输出</h5>
<p>我们知道，除了<code>console.log</code>之外，还有<code>console.debug</code>，<code>console.info</code>，<code>console.warn</code>，<code>console.error</code>这些不同级别的输出。另外一个鲜为人知的功能是，<code>console.log</code>中，你还可以对输出的文本加上css的样式，如下所示：</p>
<p><code data-enlighter-language="js" class="EnlighterJSRAW">console.log(&quot;%c左耳朵&quot;, &quot;font-size:90px;color:#888&quot;)</code></p>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17651 size-medium" src="https://coolshell.cn/wp-content/uploads/2017/01/console.log_-300x92.png" width="300" height="92" srcset="https://coolshell.cn/wp-content/uploads/2017/01/console.log_-300x92.png 300w, https://coolshell.cn/wp-content/uploads/2017/01/console.log_-768x236.png 768w, https://coolshell.cn/wp-content/uploads/2017/01/console.log_-604x185.png 604w, https://coolshell.cn/wp-content/uploads/2017/01/console.log_.png 782w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>于是，你可以定义一些相关的log函数，如：</p>
<pre data-enlighter-language="js" class="EnlighterJSRAW">console.todo = function( msg){
  console.log( &#039;%c%s %s %s&#039;, &#039;font-size:20px; color:yellow; background-color: blue;&#039;, &#039;--&#039;, msg, &#039;--&#039;);
}
console.important = function( msg){
  console.log( &#039;%c%s %s %s&#039;, &#039;font-size:20px; color:brown; font-weight: bold; text-decoration: underline;&#039;, &#039;--&#039;, msg, &#039;--&#039;);
}</pre>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17652" src="https://coolshell.cn/wp-content/uploads/2017/01/console.log2_-1024x411.png" width="500" height="201" srcset="https://coolshell.cn/wp-content/uploads/2017/01/console.log2_-1024x411.png 1024w, https://coolshell.cn/wp-content/uploads/2017/01/console.log2_-300x121.png 300w, https://coolshell.cn/wp-content/uploads/2017/01/console.log2_-768x309.png 768w, https://coolshell.cn/wp-content/uploads/2017/01/console.log2_-604x243.png 604w, https://coolshell.cn/wp-content/uploads/2017/01/console.log2_.png 1140w" sizes="(max-width: 500px) 100vw, 500px" /></p>
<p>关于console.log中的格式化，你可以参看如下表格：</p>
<table class="t1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="td1" valign="middle">指示符</td>
<td class="td2" valign="middle">输出</td>
</tr>
<tr>
<td class="td3" valign="top">%s</td>
<td class="td4" valign="top">格式化输出一个字符串变量。</td>
</tr>
<tr>
<td class="td3" valign="top">%i or %d</td>
<td class="td4" valign="top">格式化输出一个整型变量的值。</td>
</tr>
<tr>
<td class="td3" valign="top">%f</td>
<td class="td4" valign="top">格式化输出一个浮点数变量的值。</td>
</tr>
<tr>
<td class="td3" valign="top">%o</td>
<td class="td4" valign="top">格式化输出一个DOM对象。</td>
</tr>
<tr>
<td class="td3" valign="top">%O</td>
<td class="td4" valign="top">格式化输出一个Javascript对象。</td>
</tr>
<tr>
<td class="td3" valign="top">%c</td>
<td class="td4" valign="top">为后面的字符串加上CSS样式</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>除了console.log打印js的数组，你还可以使用console.table来打印，如下所示：</p>
<pre data-enlighter-language="js" class="EnlighterJSRAW">var pets = [
  { animal: &#039;Horse&#039;, name: &#039;Pony&#039;, age: 23 },
  { animal: &#039;Dog&#039;, name: &#039;Snoopy&#039;, age: 13 },
  { animal: &#039;Cat&#039;, name: &#039;Tom&#039;, age: 18 },
  { animal: &#039;Mouse&#039;, name: &#039;Jerry&#039;, age: 12}
];
console.table(pets)</pre>
<p><img decoding="async" loading="lazy" class="aligncenter wp-image-17653" src="https://coolshell.cn/wp-content/uploads/2017/01/console.table_-1024x438.png" width="500" height="214" srcset="https://coolshell.cn/wp-content/uploads/2017/01/console.table_-1024x438.png 1024w, https://coolshell.cn/wp-content/uploads/2017/01/console.table_-300x128.png 300w, https://coolshell.cn/wp-content/uploads/2017/01/console.table_-768x328.png 768w, https://coolshell.cn/wp-content/uploads/2017/01/console.table_-604x258.png 604w, https://coolshell.cn/wp-content/uploads/2017/01/console.table_.png 1142w" sizes="(max-width: 500px) 100vw, 500px" /></p>
<p>&nbsp;</p>
<h4>关于console对象</h4>
<ul>
<li>console对象除了上面的打日志的功能，其还有很多功能，比如：</li>
<li>console.trace() 可以打出js的函数调用栈</li>
<li>console.time() 和 console.timeEnd() 可以帮你计算一段代码间消耗的时间。</li>
<li>console.profile() 和 console.profileEnd() 可以让你查看CPU的消耗。</li>
<li>console.count() 可以让你看到相同的日志当前被打印的次数。</li>
<li>console.assert(expression, object) 可以让你assert一个表达式</li>
</ul>
<p>这些东西都可以看看<a href="https://developers.google.com/web/tools/chrome-devtools/console/console-reference" target="_blank">Google的Console API的文档</a>。</p>
<p>其实，还有很多东西，你可以参看Google的官方文档 &#8211; <a href="https://developers.google.com/web/tools/chrome-devtools/" target="_blank">Chrome DevTools</a></p>
<h4>关于快捷键</h4>
<p>点击在 DevTools的右上角的那三个坚排的小点，你会看到一个菜单，点选 <code>Shortcuts</code>，你就可以看到所有的快捷键了</p>
<p><img decoding="async" loading="lazy" class="aligncenter size-large wp-image-17669" src="https://coolshell.cn/wp-content/uploads/2017/01/shortcuts-1024x466.png" alt="" width="640" height="291" srcset="https://coolshell.cn/wp-content/uploads/2017/01/shortcuts-1024x466.png 1024w, https://coolshell.cn/wp-content/uploads/2017/01/shortcuts-300x137.png 300w, https://coolshell.cn/wp-content/uploads/2017/01/shortcuts-768x350.png 768w, https://coolshell.cn/wp-content/uploads/2017/01/shortcuts-593x270.png 593w, https://coolshell.cn/wp-content/uploads/2017/01/shortcuts.png 1898w" sizes="(max-width: 640px) 100vw, 640px" /></p>
<p>如果你知道更多，也欢迎补充！</p>
<p>（全文完）<!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" id="wp_rp_first"><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/30.jpg" alt="Web开发中需要了解的东西" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_title">Web开发中需要了解的东西</a></li><li ><a href="https://coolshell.cn/articles/5537.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/11/stackparts.com_-150x150.png" alt="一些文章资源和趣闻" width="150" height="150" /></a><a href="https://coolshell.cn/articles/5537.html" class="wp_rp_title">一些文章资源和趣闻</a></li><li ><a href="https://coolshell.cn/articles/4795.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/7.jpg" alt="开源中最好的Web开发的资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/4795.html" class="wp_rp_title">开源中最好的Web开发的资源</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/17634.html">Chrome开发者工具的小技巧</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/17634.html/feed</wfw:commentRss>
			<slash:comments>63</slash:comments>
		
		
			</item>
		<item>
		<title>浏览器的渲染原理简介</title>
		<link>https://coolshell.cn/articles/9666.html</link>
					<comments>https://coolshell.cn/articles/9666.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Wed, 22 May 2013 00:17:47 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[程序设计]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=9666</guid>

					<description><![CDATA[<p>看到这个标题大家一定会想到这篇神文《How Browsers Work》，这篇文章把浏览器的很多细节讲得很细，而且也被翻译成了中文。为什么我还想写一篇呢？因为两...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/9666.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/9666.html">浏览器的渲染原理简介</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>看到这个标题大家一定会想到这篇神文《<a href="http://taligarsiel.com/Projects/howbrowserswork1.htm" target="_blank">How Browsers Work</a>》，这篇文章把浏览器的很多细节讲得很细，而且也被<a href="http://ux.sohu.com/topics/50972d9ae7de3e752e0081ff" target="_blank">翻译成了中文</a>。为什么我还想写一篇呢？因为两个原因，</p>
<p style="padding-left: 30px;">1）这篇文章太长了，阅读成本太大，不能一口气读完。</p>
<p style="padding-left: 30px;">2）花了大力气读了这篇文章后可以了解很多，但似乎对工作没什么帮助。</p>
<p>所以，我准备写下这篇文章来解决上述两个问题。希望你能在上班途中，或是坐马桶时就能读完，并能从中学会一些能用在工作上的东西。</p>
<h4>浏览器工作大流程</h4>
<p>废话少说，先来看个图：</p>
<p style="text-align: center;"><img decoding="async" loading="lazy" class="aligncenter  wp-image-9667" alt="" src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process.jpg" width="712" height="231" srcset="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process.jpg 791w, https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-300x97.jpg 300w, https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-768x250.jpg 768w, https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-604x196.jpg 604w" sizes="(max-width: 712px) 100vw, 712px" /></p>
<p style="text-align: left;">从上面这个图中，我们可以看到那么几个事：</p>
<p><span id="more-9666"></span></p>
<p style="text-align: left;">1）浏览器会解析三个东西：</p>
<ul>
<li>一个是HTML/SVG/XHTML，事实上，Webkit有三个C++的类对应这三类文档。解析这三种文件会产生一个DOM Tree。</li>
</ul>
<ul>
<li>CSS，解析CSS会产生CSS规则树。</li>
</ul>
<ul>
<li>Javascript，脚本，主要是通过DOM API和CSSOM API来操作DOM Tree和CSS Rule Tree.</li>
</ul>
<p>2）解析完成后，浏览器引擎会通过DOM Tree 和 CSS Rule Tree 来构造 Rendering Tree。注意：</p>
<ul>
<li>Rendering Tree 渲染树并不等同于DOM树，因为一些像Header或display:none的东西就没必要放在渲染树中了。</li>
</ul>
<ul>
<li>CSS 的 Rule Tree主要是为了完成匹配并把CSS Rule附加上Rendering Tree上的每个Element。也就是DOM结点。也就是所谓的Frame。</li>
</ul>
<ul>
<li>然后，计算每个Frame（也就是每个Element）的位置，这又叫layout和reflow过程。</li>
</ul>
<p>3）最后通过调用操作系统Native GUI的API绘制。</p>
<h4>DOM解析</h4>
<p>HTML的DOM Tree解析如下：</p>
<pre data-enlighter-language="html" class="EnlighterJSRAW">
&lt;html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Web page parsing&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
    &lt;div&gt;
        &lt;h1&gt;Web page parsing&lt;/h1&gt;
        &lt;p&gt;This is an example Web page.&lt;/p&gt;
    &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>上面这段HTML会解析成这样：</p>
<p style="text-align: center;"><img decoding="async" loading="lazy" class="aligncenter  wp-image-9669" alt="" src="https://coolshell.cn/wp-content/uploads/2013/05/DOM-Tree-01.jpg" width="456" height="300" srcset="https://coolshell.cn/wp-content/uploads/2013/05/DOM-Tree-01.jpg 651w, https://coolshell.cn/wp-content/uploads/2013/05/DOM-Tree-01-300x197.jpg 300w" sizes="(max-width: 456px) 100vw, 456px" /></p>
<p>下面是另一个有SVG标签的情况。</p>
<p style="text-align: center;"><img decoding="async" loading="lazy" class="aligncenter  wp-image-9670" alt="" src="https://coolshell.cn/wp-content/uploads/2013/05/DOM-Tree-02.jpg" width="408" height="320" srcset="https://coolshell.cn/wp-content/uploads/2013/05/DOM-Tree-02.jpg 680w, https://coolshell.cn/wp-content/uploads/2013/05/DOM-Tree-02-300x235.jpg 300w" sizes="(max-width: 408px) 100vw, 408px" /></p>
<h4>CSS解析</h4>
<p>CSS的解析大概是下面这个样子（下面主要说的是Gecko也就是Firefox的玩法），假设我们有下面的HTML文档：</p>
<pre data-enlighter-language="html" class="EnlighterJSRAW">
&lt;doc&gt;
&lt;title&gt;A few quotes&lt;/title&gt;
&lt;para&gt;
  Franklin said that &lt;quote&gt;&quot;A penny saved is a penny earned.&quot;&lt;/quote&gt;
&lt;/para&gt;
&lt;para&gt;
  FDR said &lt;quote&gt;&quot;We have nothing to fear but &lt;span&gt;fear itself.&lt;/span&gt;&quot;&lt;/quote&gt;
&lt;/para&gt;
&lt;/doc&gt;
</pre>
<p>于是DOM Tree是这个样子：</p>
<p><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-9672" alt="" src="https://coolshell.cn/wp-content/uploads/2013/05/DOM-Tree-Example.jpg" width="368" height="318" srcset="https://coolshell.cn/wp-content/uploads/2013/05/DOM-Tree-Example.jpg 368w, https://coolshell.cn/wp-content/uploads/2013/05/DOM-Tree-Example-300x259.jpg 300w" sizes="(max-width: 368px) 100vw, 368px" /></p>
<p>然后我们的CSS文档是这样的：</p>
<pre data-enlighter-language="html" class="EnlighterJSRAW">  /* rule 1 */ doc { display: block; text-indent: 1em; }
/* rule 2 */ title { display: block; font-size: 3em; }
/* rule 3 */ para { display: block; }
/* rule 4 */ [class=&quot;emph&quot;] { font-style: italic; }</pre>
<p>于是我们的CSS Rule Tree会是这个样子：</p>
<p><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-9673" alt="" src="https://coolshell.cn/wp-content/uploads/2013/05/CSS-Rule-Tree-Example.jpg" width="397" height="238" srcset="https://coolshell.cn/wp-content/uploads/2013/05/CSS-Rule-Tree-Example.jpg 397w, https://coolshell.cn/wp-content/uploads/2013/05/CSS-Rule-Tree-Example-300x179.jpg 300w" sizes="(max-width: 397px) 100vw, 397px" /></p>
<p>注意，图中的第4条规则出现了两次，一次是独立的，一次是在规则3的子结点。所以，我们可以知道，建立CSS Rule Tree是需要比照着DOM Tree来的。CSS匹配DOM Tree主要是从右到左解析CSS的Selector，好多人以为这个事会比较快，其实并不一定。关键还看我们的CSS的Selector怎么写了。</p>
<p><strong>注意：CSS匹配HTML元素是一个相当复杂和有性能问题的事情。所以，你就会在N多地方看到很多人都告诉你，DOM树要小，CSS尽量用id和class，千万不要过渡层叠下去，……</strong></p>
<p>通过这两个树，我们可以得到一个叫Style Context Tree，也就是下面这样（把CSS Rule结点Attach到DOM Tree上）：</p>
<p><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-9674" alt="" src="https://coolshell.cn/wp-content/uploads/2013/05/CSS-Content-Tree-Example.jpg" width="405" height="318" srcset="https://coolshell.cn/wp-content/uploads/2013/05/CSS-Content-Tree-Example.jpg 405w, https://coolshell.cn/wp-content/uploads/2013/05/CSS-Content-Tree-Example-300x235.jpg 300w" sizes="(max-width: 405px) 100vw, 405px" /></p>
<p>所以，Firefox基本上来说是通过CSS 解析 生成 CSS Rule Tree，然后，通过比对DOM生成Style Context Tree，然后Firefox通过把Style Context Tree和其Render Tree（Frame Tree）关联上，就完成了。注意：Render Tree会把一些不可见的结点去除掉。而<strong>Firefox中所谓的Frame就是一个DOM结点，不要被其名字所迷惑了</strong>。</p>
<p style="text-align: center;"><img decoding="async" loading="lazy" class="aligncenter  wp-image-9677" alt="" src="https://coolshell.cn/wp-content/uploads/2013/05/Firefox-style-context-tree.png" width="328" height="366" srcset="https://coolshell.cn/wp-content/uploads/2013/05/Firefox-style-context-tree.png 364w, https://coolshell.cn/wp-content/uploads/2013/05/Firefox-style-context-tree-268x300.png 268w" sizes="(max-width: 328px) 100vw, 328px" /></p>
<p>注：Webkit不像Firefox要用两个树来干这个，Webkit也有Style对象，它直接把这个Style对象存在了相应的DOM结点上了。</p>
<h4>渲染</h4>
<p>渲染的流程基本上如下（黄色的四个步骤）：</p>
<ol>
<li>计算CSS样式</li>
<li>构建Render Tree</li>
<li>Layout &#8211; 定位坐标和大小，是否换行，各种position, overflow, z-index属性 ……</li>
<li>正式开画</li>
</ol>
<p style="text-align: center;"><img decoding="async" loading="lazy" class="aligncenter  wp-image-9675" alt="" src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-Skipping.jpg" width="712" height="196" srcset="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-Skipping.jpg 1318w, https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-Skipping-300x82.jpg 300w, https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-Skipping-1024x282.jpg 1024w" sizes="(max-width: 712px) 100vw, 712px" /></p>
<p style="text-align: left;">注意：上图流程中有很多连接线，这表示了Javascript动态修改了DOM属性或是CSS属会导致重新Layout，有些改变不会，就是那些指到天上的箭头，比如，修改后的CSS rule没有被匹配到，等。</p>
<p style="text-align: left;">这里重要要说两个概念，一个是Reflow，另一个是Repaint。这两个不是一回事。</p>
<ul>
<li>Repaint——屏幕的一部分要重画，比如某个CSS的背景色变了。但是元素的几何尺寸没有变。</li>
</ul>
<ul>
<li>Reflow——意味着元件的几何尺寸变了，我们需要重新验证并计算Render Tree。是Render Tree的一部分或全部发生了变化。这就是Reflow，或是Layout。（<strong>HTML使用的是flow based layout，也就是流式布局，所以，如果某元件的几何尺寸发生了变化，需要重新布局，也就叫reflow</strong>）reflow 会从&lt;html&gt;这个root frame开始递归往下，依次计算所有的结点几何尺寸和位置，在reflow过程中，可能会增加一些frame，比如一个文本字符串必需被包装起来。</li>
</ul>
<p>下面是一个打开Wikipedia时的Layout/reflow的视频（注：HTML在初始化的时候也会做一次reflow，叫 <dfn>intial reflow</dfn>），你可以感受一下：</p>
<p><center><object width="480" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" align="middle"><param name="src" value="http://player.youku.com/player.php/sid/XMzI5MDg0OTA0/v.swf" /><param name="allowfullscreen" value="true" /><param name="quality" value="high" /><param name="allowscriptaccess" value="always" /><embed width="480" height="400" type="application/x-shockwave-flash" src="http://player.youku.com/player.php/sid/XMzI5MDg0OTA0/v.swf" allowfullscreen="true" quality="high" allowscriptaccess="always" align="middle" /></object></center>Reflow的成本比Repaint的成本高得多的多。DOM Tree里的每个结点都会有reflow方法，一个结点的reflow很有可能导致子结点，甚至父点以及同级结点的reflow。<strong>在一些高性能的电脑上也许还没什么，但是如果reflow发生在手机上，那么这个过程是非常痛苦和耗电的</strong>。</p>
<p>所以，下面这些动作有很大可能会是成本比较高的。</p>
<ul>
<li>当你增加、删除、修改DOM结点时，会导致Reflow或Repaint</li>
<li>当你移动DOM的位置，或是搞个动画的时候。</li>
<li>当你修改CSS样式的时候。</li>
<li>当你Resize窗口的时候（移动端没有这个问题），或是滚动的时候。</li>
<li>当你修改网页的默认字体时。</li>
</ul>
<p style="text-align: left;">注：display:none会触发reflow，而visibility:hidden只会触发repaint，因为没有发现位置变化。</p>
<p style="text-align: left;">多说两句关于滚屏的事，通常来说，如果在滚屏的时候，我们的页面上的所有的像素都会跟着滚动，那么性能上没什么问题，因为我们的显卡对于这种把全屏像素往上往下移的算法是很快。但是如果你有一个fixed的背景图，或是有些Element不跟着滚动，有些Elment是动画，那么这个滚动的动作对于浏览器来说会是相当相当痛苦的一个过程。你可以看到很多这样的网页在滚动的时候性能有多差。因为滚屏也有可能会造成reflow。</p>
<p style="text-align: left;">基本上来说，reflow有如下的几个原因：</p>
<ul>
<li>Initial。网页初始化的时候。</li>
<li>Incremental。一些Javascript在操作DOM Tree时。</li>
<li>Resize。其些元件的尺寸变了。</li>
<li>StyleChange。如果CSS的属性发生变化了。</li>
<li>Dirty。几个Incremental的reflow发生在同一个frame的子树上。</li>
</ul>
<p style="text-align: left;">好了，我们来看一个示例吧：</p>
<p>[javascript]var bstyle = document.body.style; // cache</p>
<p>bstyle.padding = &quot;20px&quot;; // reflow, repaint<br />
bstyle.border = &quot;10px solid red&quot;; //  再一次的 reflow 和 repaint</p>
<p>bstyle.color = &quot;blue&quot;; // repaint<br />
bstyle.backgroundColor = &quot;#fad&quot;; // repaint</p>
<p>bstyle.fontSize = &quot;2em&quot;; // reflow, repaint</p>
<p>// new DOM element &#8211; reflow, repaint<br />
document.body.appendChild(document.createTextNode(&#8216;dude!&#8217;));[/javascript]</p>
<p style="text-align: left;">当然，我们的浏览器是聪明的，它不会像上面那样，你每改一次样式，它就reflow或repaint一次。<strong>一般来说，浏览器会把这样的操作积攒一批，然后做一次reflow，这又叫异步reflow或增量异步reflow</strong>。但是有些情况浏览器是不会这么做的，比如：resize窗口，改变了页面默认的字体，等。对于这些操作，浏览器会马上进行reflow。</p>
<p style="text-align: left;">但是有些时候，我们的脚本会阻止浏览器这么干，比如：如果我们请求下面的一些DOM值：</p>
<ol>
<li>offsetTop, offsetLeft, offsetWidth, offsetHeight</li>
<li>scrollTop/Left/Width/Height</li>
<li>clientTop/Left/Width/Height</li>
<li>IE中的 getComputedStyle(), 或 currentStyle</li>
</ol>
<p style="text-align: left;">因为，如果我们的程序需要这些值，那么浏览器需要返回最新的值，而这样一样会flush出去一些样式的改变，从而造成频繁的reflow/repaint。</p>
<h4 style="text-align: left;">减少reflow/repaint</h4>
<p>下面是一些Best Practices：</p>
<p><strong>1）不要一条一条地修改DOM的样式。与其这样，还不如预先定义好css的class，然后修改DOM的className。</strong></p>
<p>[javascript]// bad<br />
var left = 10,<br />
top = 10;<br />
el.style.left = left + &quot;px&quot;;<br />
el.style.top  = top  + &quot;px&quot;;</p>
<p>// Good<br />
el.className += &quot; theclassname&quot;;</p>
<p>// Good<br />
el.style.cssText += &quot;; left: &quot; + left + &quot;px; top: &quot; + top + &quot;px;&quot;;[/javascript]</p>
<p><strong>2）把DOM离线后修改。如：</strong></p>
<ul>
<li>使用documentFragment 对象在内存里操作DOM</li>
<li>先把DOM给display:none(有一次reflow)，然后你想怎么改就怎么改。比如修改100次，然后再把他显示出来。</li>
<li>clone一个DOM结点到内存里，然后想怎么改就怎么改，改完后，和在线的那个的交换一下。</li>
</ul>
<p>3）<strong>不要把DOM结点的属性值放在一个循环里当成循环里的变量。</strong>不然这会导致大量地读写这个结点的属性。</p>
<p>4）<strong>尽可能的修改层级比较低的DOM</strong>。当然，改变层级比较底的DOM有可能会造成大面积的reflow，但是也可能影响范围很小。</p>
<p>5）<strong>为动画的HTML元件使用fixed或absoult的position</strong>，那么修改他们的CSS是不会reflow的。</p>
<p>6）<strong>千万不要使用table布局</strong>。因为可能很小的一个小改动会造成整个table的重新布局。</p>
<blockquote><p>In this manner, the user agent can begin to lay out the table once the entire first row has been received. Cells in subsequent rows do not affect column widths. Any cell that has content that overflows uses the ‘overflow’ property to determine whether to clip the overflow content.</p>
<p><cite><a href="http://www.w3.org/TR/CSS21/tables.html#fixed-table-layout">Fixed layout, CSS 2.1 Specification</a></cite></p></blockquote>
<blockquote><p>This algorithm may be inefficient since it requires the user agent to have access to all the content in the table before determining the final layout and may demand more than one pass.</p>
<p><cite><a href="http://www.w3.org/TR/CSS21/tables.html#auto-table-layout">Automatic layout, CSS 2.1 Specification</a></cite></p></blockquote>
<h4>几个工具和几篇文章</h4>
<p>有时候，你会也许会发现在IE下，你不知道你修改了什么东西，结果CPU一下子就上去了到100%，然后过了好几秒钟repaint/reflow才完成，这种事情以IE的年代时经常发生。所以，我们需要一些工具帮我们看看我们的代码里有没有什么不合适的东西。</p>
<ul>
<li>Chrome下，Google的<a href="http://code.google.com/webtoolkit/speedtracer/">SpeedTracer</a>是个非常强悍的工作让你看看你的浏览渲染的成本有多大。其实Safari和Chrome都可以使用开发者工具里的一个Timeline的东东。</li>
</ul>
<ul>
<li>Firefox下这个基于Firebug的叫<a href="https://addons.mozilla.org/en-US/firefox/addon/firebug-paint-events/" target="_blank">Firebug Paint Events</a>的插件也不错。</li>
</ul>
<ul>
<li>IE下你可以用一个叫<a href="http://ajax.dynatrace.com/pages/">dynaTrace</a>的IE扩展。</li>
</ul>
<p>最后，别忘了下面这几篇提高浏览器性能的文章：</p>
<ul>
<li><a href="http://code.google.com/speed/page-speed/docs/rules_intro.html">Google &#8211; Web Performance Best Practices</a></li>
<li><a href="http://developer.yahoo.com/performance/rules.html">Yahoo &#8211; Best Practices for Speeding Up Your Web Site</a></li>
<li><a href="http://stevesouders.com/hpws/rules.php">Steve Souders &#8211; 14 Rules for Faster-Loading Web Sites</a></li>
</ul>
<h4>参考</h4>
<ul>
<li>David Baron的演讲：Fast CSS: How Browsers Lay Out Web Pages：<a href="http://dbaron.org/talks/2012-03-11-sxsw/slide-1.xhtml" target="_blank">slideshow</a>, <a href="http://dbaron.org/talks/2012-03-11-sxsw/master.xhtml">all slides</a>, <a href="http://audio.sxsw.com/2012/podcasts/11-ACC-Fast_CSS_How_Browser_Layout.mp3">audio (MP3)</a>, <a href="http://schedule.sxsw.com/2012/events/event_IAP12909">Session page</a>, <a href="http://lanyrd.com/2012/sxsw-interactive/spmbt/">Lanyrd page</a></li>
</ul>
<ul>
<li>How Browsers Work: <a href="http://taligarsiel.com/Projects/howbrowserswork1.htm" target="_blank">http://taligarsiel.com/Projects/howbrowserswork1.htm</a></li>
</ul>
<ul>
<li>Mozilla 的 Style System Overview：<a href="https://developer.mozilla.org/en-US/docs/Style_System_Overview" target="_blank">https://developer.mozilla.org/en-US/docs/Style_System_Overview</a></li>
</ul>
<ul>
<li>Mozilla 的 Note of reflow： <a href="http://www-archive.mozilla.org/newlayout/doc/reflow.html" target="_blank">http://www-archive.mozilla.org/newlayout/doc/reflow.html</a></li>
</ul>
<ul>
<li>Rendering: repaint, reflow/relayout, restyle：<a href="http://www.phpied.com/rendering-repaint-reflowrelayout-restyle/" target="_blank">http://www.phpied.com/rendering-repaint-reflowrelayout-restyle/</a></li>
</ul>
<ul>
<li>Effective Rendering CSS：<a href="http://css-tricks.com/efficiently-rendering-css/" target="_blank">http://css-tricks.com/efficiently-rendering-css/</a></li>
</ul>
<ul>
<li><strong></strong>Webkit Rendering文档：<a href="http://trac.webkit.org/wiki/WebCoreRendering" target="_blank">http://trac.webkit.org/wiki/WebCoreRendering</a></li>
</ul>
<p><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/9749.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/06/javascript-150x150.jpg" alt="Javascript 装载和执行" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9749.html" class="wp_rp_title">Javascript 装载和执行</a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/30.jpg" alt="Web开发中需要了解的东西" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_title">Web开发中需要了解的东西</a></li><li ><a href="https://coolshell.cn/articles/5537.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/11/stackparts.com_-150x150.png" alt="一些文章资源和趣闻" width="150" height="150" /></a><a href="https://coolshell.cn/articles/5537.html" class="wp_rp_title">一些文章资源和趣闻</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/9666.html">浏览器的渲染原理简介</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/9666.html/feed</wfw:commentRss>
			<slash:comments>155</slash:comments>
		
		<enclosure url="http://audio.sxsw.com/2012/podcasts/11-ACC-Fast_CSS_How_Browser_Layout.mp3" length="20902392" type="audio/mpeg" />

			</item>
		<item>
		<title>神奇的CSS形状</title>
		<link>https://coolshell.cn/articles/6913.html</link>
					<comments>https://coolshell.cn/articles/6913.html#comments</comments>
		
		<dc:creator><![CDATA[Neo]]></dc:creator>
		<pubDate>Sat, 24 Mar 2012 12:35:41 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[编程语言]]></category>
		<category><![CDATA[趣味问题]]></category>
		<category><![CDATA[CSS]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=6913</guid>

					<description><![CDATA[<p>【感谢 Neo 投递本文 – 微博帐号：@_锟_ 】 在StackOverflow上有这么一个问题，有位同学在http://css-tricks.com/exa...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/6913.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/6913.html">神奇的CSS形状</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>【<span style="color: #cc0000;">感谢 Neo 投递本文 – 微博帐号</span>：<a title="_锟_" href="http://weibo.com/gandalfthegrey" target="_blank">@_锟_</a> 】</p>
<p style="text-align: left;">在StackOverflow上有这么一个问题，有位同学在<a href="http://css-tricks.com/examples/ShapesOfCSS/">http://css-tricks.com/examples/ShapesOfCSS/ </a> 找到一些使用CSS做的形状，其中一位同学对下面的这个形状充满了疑问。</p>
<p style="text-align: left;">形状是：</p>
<p style="text-align: left;"><img decoding="async" loading="lazy" class="size-full wp-image-6914" src="https://coolshell.cn/wp-content/uploads/2012/03/a.png" alt="" width="103" height="102" /></p>
<p style="text-align: left;">代码是：</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#triangle-up {
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid red;
}
</pre>
<p>这位同学就提问啦，为啥这么这么几句就能画出一个三角形呢？<br />
于是呢，有高人出现，这个高人图文并茂的解释了这个三角的成因</p>
<p><span id="more-6913"></span><br />
首先呢，我们需要了解HTML标记的Box Model（盒模型），这个例子中呢我们将content，padding都看作content。忽略掉margin。那么一个盒模型就是下图</p>
<p style="text-align: left;"><img decoding="async" loading="lazy" class="size-full wp-image-6915" src="https://coolshell.cn/wp-content/uploads/2012/03/b.png" alt="" width="340" height="266" srcset="https://coolshell.cn/wp-content/uploads/2012/03/b.png 340w, https://coolshell.cn/wp-content/uploads/2012/03/b-300x234.png 300w" sizes="(max-width: 340px) 100vw, 340px" /></p>
<p>中间是内容，然后是4条边。每一条边都有宽度。<br />
根据上面CSS的定义，没有border-top（顶边）的情形下 ,我们的图形如下：</p>
<p style="text-align: left;"><img decoding="async" loading="lazy" class="size-full wp-image-6916" src="https://coolshell.cn/wp-content/uploads/2012/03/c.png" alt="" width="340" height="266" srcset="https://coolshell.cn/wp-content/uploads/2012/03/c.png 340w, https://coolshell.cn/wp-content/uploads/2012/03/c-300x234.png 300w" sizes="(max-width: 340px) 100vw, 340px" /></p>
<p>width设置为0后 ，内容没有了就成为下图：</p>
<p style="text-align: left;"><img decoding="async" loading="lazy" class="size-full wp-image-6917" src="https://coolshell.cn/wp-content/uploads/2012/03/d.png" alt="" width="340" height="266" srcset="https://coolshell.cn/wp-content/uploads/2012/03/d.png 340w, https://coolshell.cn/wp-content/uploads/2012/03/d-300x234.png 300w" sizes="(max-width: 340px) 100vw, 340px" /></p>
<p>height也设置为0，只有底边了。</p>
<p style="text-align: left;"><img decoding="async" loading="lazy" class="size-full wp-image-6918" src="https://coolshell.cn/wp-content/uploads/2012/03/e.png" alt="" width="200" height="122" /></p>
<p>然后两条边都是设置为透明，最后我们就得到了</p>
<p style="text-align: left;"><img decoding="async" loading="lazy" class="size-full wp-image-6919" src="https://coolshell.cn/wp-content/uploads/2012/03/f.png" alt="" width="200" height="122" /></p>
<p>这个属于奇技淫巧，但是也说明CSS的强大，没有做不到只有想不到。另外<a href="http://css-tricks.com/examples/ShapesOfCSS/">http://css-tricks.com/examples/ShapesOfCSS/ </a>还能找到很多其他的形状，感兴趣的同学可以自己去看。还有酷壳以前的这篇文章《<a title="CSS图形" href="https://coolshell.cn/articles/5164.html" target="_blank">CSS实现的各种形状</a>》<!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/30.jpg" alt="Web开发中需要了解的东西" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_title">Web开发中需要了解的东西</a></li><li ><a href="https://coolshell.cn/articles/5164.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/9.jpg" alt="CSS图形" width="150" height="150" /></a><a href="https://coolshell.cn/articles/5164.html" class="wp_rp_title">CSS图形</a></li><li ><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/14.jpg" alt="一些有意思的贴子和工具" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_title">一些有意思的贴子和工具</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/6913.html">神奇的CSS形状</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/6913.html/feed</wfw:commentRss>
			<slash:comments>21</slash:comments>
		
		
			</item>
		<item>
		<title>CSS 布局:40个教程、技巧、例子和最佳实践</title>
		<link>https://coolshell.cn/articles/6840.html</link>
					<comments>https://coolshell.cn/articles/6840.html#comments</comments>
		
		<dc:creator><![CDATA[Neo]]></dc:creator>
		<pubDate>Mon, 19 Mar 2012 00:25:46 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[编程语言]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=6840</guid>

					<description><![CDATA[<p>【感谢 Neo 投递本文 – 微博帐号：_锟_ 】 前言： 布局是WEB开发一个重要的课题，进入XHTML/CSS后，使用TABLE布局的方式逐渐淡出，CSS布...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/6840.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/6840.html">CSS 布局:40个教程、技巧、例子和最佳实践</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>【<span style="color: #cc0000;">感谢 Neo 投递本文 – 微博帐号</span>：<a title="_锟_" href="http://weibo.com/gandalfthegrey" target="_blank">_锟_</a> 】</p>
<p><strong>前言：</strong> 布局是WEB开发一个重要的课题，进入XHTML/CSS后，使用TABLE布局的方式逐渐淡出，CSS布局以众多优点成为主流，本文将介绍40个基于CSS的web布局的资源和教程。文章的出处在<a href="http://www.noupe.com/css/css-layouts-40-tutorials-tips-demos-and-best-practices.html" target="_blank">http://www.noupe.com/css/css-layouts-40-tutorials-tips-demos-and-best-practices.html</a>。文中的不少的例子在一本经典的CSS书籍<a href="http://shop.oreilly.com/product/9780596802455.do">《CCS: The Missing Manual, 2nd Edition》</a>中都可以找到，据我所知，第二版在中国没有翻译出版。你可以从<a href="http://www.itpub.net/forum.php?mod=viewthread&amp;tid=1210179&amp;highlight=CSS%2Bthe%2Bmissing%2Bmanual">这里</a>下载英文版（不过需要注册个用户名）</p>
<p><strong>正文</strong><br />
<strong>基于CSS的布局</strong>能提供更灵活布局方式和更强的用户视觉体验。一些重要技巧和关键点可以帮助初学者理解CSS布局的基础和本质。这也是本文成文的原因 ——找到那些完美的布局，<strong>完全灵活的，等高栏</strong>和工作完美的布局。<br />
因此下面这个列表就是我们整理了网络上关于基于CSS布局的一些技巧，教程和最佳实践的列表。<br />
当然你也可能对下面这些和CSS相关的主题有兴趣：</p>
<p><a href="http://www.noupe.com/css/9-timeless-3-column-layout-techniques.html&gt;9 Timeless 3 Column Layout Techniques&lt;/a&gt;&lt;/ui&gt;&lt;br /&gt; &lt;ui&gt;&lt;a href=">The 7 CSS Hacks that we should use</a><br />
<a href="http://www.noupe.com/css/using-css-to-do-anything-50-creative-examples-and-tutorials.html">Using CSS to Do Anything: 50+ Creative Examples and Tutorials</a><br />
<a href="http://www.noupe.com/css/using-css-to-fix-anything-20-common-bugs-and-fixes.html">Using CSS to Fix Anything: 20+ Common Bugs and Fixes</a></p>
<p><span id="more-6840"></span></p>
<h4><strong><span style="color: #008000;">CSS 布局教程</span></strong></h4>
<p>1-<a href="http://woork.blogspot.com/2008/01/three-column-fixed-layout-structure.html">使用CSS完成三栏固定布局结构</a>&#8211; 这篇文章解释了如何实现一个基于的HTML/CSS来设计一个简单的带有基本要素（顶部的logo条，导航条，文本区，定义分类的中部栏，右边侧栏插入google的120X600的广告区）的固定三栏页面布局。</p>
<p><img decoding="async" loading="lazy" class="size-full wp-image-6843 aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts.gif" alt="" width="450" height="297" /></p>
<p>2-<a href="http://woork.blogspot.com/2007/10/design-page-layout-using-css.html">使用CSS设计页面布局</a>&#8211; 如何使用CSS文件来为你的站点设计页面布局。<br />
<img decoding="async" loading="lazy" class="size-full wp-image-6844 aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts2.gif" alt="" width="450" height="200" /></p>
<p>3-<a href="http://css-tricks.com/how-to-create-a-horizontally-scrolling-site/">如何创建一个水平布局的站点</a>&#8211; 创建不同于常规的水平布局的站点技术（译者注：水平布局，客户体验也就仁者见仁了）</p>
<p><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-6845" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts3.gif" alt="" width="450" height="190" /><br />
例子<a href="http://css-tricks.com/examples/HorzScrolling">查看这里</a> |<a href="http://css-tricks.com/examples/HorzScrolling.zip">下载</a></p>
<p>4-<a href="http://css-tricks.com/super-simple-two-column-layout/">超级简单的两栏布局</a>&#8211; 创建不同于常规的水平布局的站点技术（译者注：这里是原作者笔误吧和上面的内容一样）.</p>
<p><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-6849" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts4.gif" alt="" width="450" height="100" /></p>
<p>例子<a href="http://css-tricks.com/examples/SuperSimpleTwoColumn">查看这里</a> <a href="http://css-tricks.com/examples/SuperSimpleTwoColumn.zip">下载</a></p>
<p>5-<a href="http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/">简单两栏CSS布局</a>&#8211; 这是一个创建简单两栏布局的教程。这种布局包含了一个标题区，一个水平导航条，主内容区，边侧栏，和页脚区。并且这个布局是水平居中的。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts6.gif" alt="" width="450" height="150" /></p>
<p>例子<a href="http://www.456bereastreet.com/lab/developing_with_web_standards/csslayout/2-col/finished.html">查看这里</a></p>
<p>6-<a href="http://dnevnikeklektika.com/en/the-holy-grail-layout-3-columns-and-a-lot-less-problems">圣杯布局(The holy grail layout)</a> – 3栏布局会有一些问题 ，这篇文章讨论了一种三栏布局——两栏固定宽度边侧栏加上一栏变宽中栏布局，保证了页面的良好结构和清晰。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts7.gif" alt="" width="450" height="362" /></p>
<p>例子<a href="http://dnevnikeklektika.com/css/3ColLayout/working.html">查看这里</a></p>
<p>7-<a href="http://www.simplebits.com/notebook/2004/09/08/centering.html">CSS居中101</a>&#8211; 如何使用CSS完成居中一个固定宽度的布局</p>
<p>使用CSS，通过下面两条规则完成对id为container的DIV所包含的内容居中</p>
<pre data-enlighter-language="html" class="EnlighterJSRAW">
&lt;body&gt;
 &lt;div id=&quot;container&quot;&gt; ...entire layout goes here...
&lt;/div&gt;
&lt;/body&gt;
</pre>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
body {
    text-align: center;
}
#container {
    margin: 0 auto;
    width: xxxpx;
    text-align: left;
}
</pre>
<p>8-<a href="http://www.subcide.com/tutorials/csslayout/index.aspx">从头创建CSS布局</a>&#8211; 这个指南通过创建一个全功能的 CSS布局来一步步教你入门CSS布局。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts9.gif" alt="" width="450" height="255" /></p>
<p>9-<a href="http://www.alistapart.com/articles/multicolumnlayouts/">非主流！多栏布局</a>&#8211; 多栏布局，等高栏（每一列的高度都相等），固定或变宽中央区，简洁标记，CSS 。(译者注：原文作者的图配的和上图一样)</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts9.gif" alt="" width="450" height="255" /></p>
<p>例子<a href="http://www.alistapart.com/d/multicolumnlayouts/3ColLiquid.html">查看这里</a></p>
<p>10- <a href="http://www.positioniseverything.net/articles/onetruelayout/">创建天下无双的CSS布局</a>&#8211; 高灵活性布局,等高栏，跨栏垂直摆放元素。本文告诉你通过何等手段完成这些目标，并使用它们创建天下无双的CSS布局（译者注:原文是One True Layout ，不知道怎么翻译，就天下无双吧。）</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts22.gif" alt="" width="450" height="180" /></p>
<p><a href="http://www.positioniseverything.net/articles/onetruelayout/examples">查看这里</a></p>
<p>11-<a href="http://nettuts.com/site-builds/from-psd-to-html-building-a-set-of-website-designs-step-by-step/">从PSD到HTML，手把手完成WEB设计</a>-从Photoshop到完整HTML，全过程手把手教会你。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts34.jpg" alt="" width="450" height="341" /></p>
<p>例子<a href="http://nettuts.s3.amazonaws.com/017_Creatif/Site/index.html">查看这里</a> | <a href="http://nettuts.s3.amazonaws.com/017_Creatif/Site_Download.zip">下载</a></p>
<p>12- <a href="http://tutorialblog.org/5-tips-for-coding-xhtmlcss-layouts/">5个XHTML/CSS技巧</a> &#8211; 5个CSS技巧帮助你完成从基于表格的布局到基于CSS的布局。</p>
<p>13-<a href="http://veerle.duoh.com/index.php/blog/comments/designing_a_css_based_template_part_i/">设计一个基于CSS的模板</a> &#8211; 这是一个教你创建基于CSS的模板页的基础教程。这个教程由下面几个部分构成：第一部分覆盖了在Photoshop CS*中的创建导航条按钮，第二部分：创建背景接下来的清单是标题和页面布局，最后的部分在XHTML和CSS中实现。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts35.jpg" alt="" width="450" height="250" /></p>
<p><a href="http://homepage.mac.com/vpieters/css_step2/step2_whooshes.mov.zip">下载</a></p>
<p>14-<a href="http://www.sitepoint.com/article/breaking-out-of-the-box">使用CSS布局跳出常规布局</a>&#8211; 如果你理解了基于表格布局的工作方式，你能通过合并或拆分表格创建你随心所欲的布局。就这个目标（同时支持灵活性和可维护性），CSS能够提供比基于表格更多地东西。Jina Bolton的教程解释如何达到这个目标。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts36.gif" alt="" width="450" height="250" /></p>
<p>15-<a href="http://www.webreference.com/authoring/style/sheets/layout/advanced/">高级CSS教程:手把手</a>&#8211; 这个教程的终极目标创建一个CSS布局，这个CSS布局精确地重组了原有使用table的WebReference.com的布局。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts29.gif" alt="" width="450" height="263" /></p>
<p>16-<a href="http://snook.ca/archives/html_and_css/six_keys_to_understanding_css_layouts/">了解CSS布局的6个关键要素</a>-本文讲述了6件基于CSS布局需要了解的事情：盒模型(Box Model)，浮动栏(Floated Columns) （译者注：float是WEB布局最重要的一个属性了）。使用Em来设置尺寸（Sizing Using Ems），图片替换（Image Replacement）,浮动导航和Sprintes。</p>
<p>17-<a href="http://wisdump.com/design/are-you-making-these-common-blog-layout-mistakes/">你会犯这些常见的博客布局错误吗？</a>-讨论4个博客布局中常见而且易修复的错误。</p>
<p>18-<a href="http://www.htmldog.com/guides/cssadvanced/layout/">页面布局</a>-CSS页面布局中的浮动元素和定位元素实践指导。</p>
<p>你可以查看这些例子：<a href="http://www.htmldog.com/examples/positioning4.html">Absolute Position within a relative box</a><a href="http://www.htmldog.com/examples/float2.html"> two floated boxes</a>和<a href="http://www.htmldog.com/examples/pagelayout3.html"> using a border to provide the background for a column</a></p>
<p>19-<a href="http://leftjustified.net/site-in-an-hour/">Site in an Hour</a>&#8211; 使用复杂CCS布局完成简单的工作。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts40.jpg" alt="" width="450" height="250" /></p>
<h4><strong><span style="color: #008000;">关于布局的最佳资源</span></strong></h4>
<p>下面的大多数这些资源不需要许可就能直接使用，然而，其中的一些需要先发邮件确认一下是否可以使用这些资源。因此，在使用之前最好先检查资源的版权信息。</p>
<p>20-<a href="http://www.maxdesign.com.au/presentation/page_layouts/">简单CSS页面布局</a>&#8211; 这里有一套2栏和3栏的CSS布局。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts10.jpg" alt="" width="450" height="255" /></p>
<p>你可以通过这里查看这些样例<a href="http://www.maxdesign.com.au/presentation/process/example23.htm"> Liquid three column layout</a>,<a href="http://www.maxdesign.com.au/presentation/page_layouts/single04.htm"> Left aligned, set width</a> and <a href="http://www.maxdesign.com.au/presentation/liquid/example13.htm">Liquid insanity</a>.</p>
<p>21-<a href="http://matthewjamestaylor.com/blog/perfect-3-column.htm">完美的三栏变宽布局（百分比定宽度）The Perfect 3 Column Liquid Layout (Percentage widths)</a>&#8211; 没有CSS hack（译者注：不知道怎么翻译，点击<a href="http://baike.baidu.com/view/1119452.htm">这里</a>查看解释）. 良好地收索引擎优化.无图. 无Javascript. 跨浏览器 和IPHONE设备兼容</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts11.gif" alt="" width="450" height="370" /></p>
<p>你可以通过这里查看样例 <a href="http://www.maxdesign.com.au/presentation/process/example23.htm">Liquid three column layout</a>, <a href="http://www.maxdesign.com.au/presentation/page_layouts/single04.htm">Left aligned, set width</a> 和 <a href="http://www.maxdesign.com.au/presentation/liquid/example13.htm">Liquid insanity</a>. (译者注：这里的链接和上面重复了，哎，原文的错误吧)</p>
<p>22-<a href="http://www.intensivstation.ch/en/templates/">CSS模板和样例</a></p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts21.gif" alt="" width="450" height="380" /></p>
<p>你可以通过这里查看这些样例<a href="http://www.intensivstation.ch/files/en_templates/temp06.html"> 3 columns fixed</a> <a href="http://www.intensivstation.ch/files/en_templates/temp06.html">centered</a>, <a href="http://www.intensivstation.ch/files/en_templates/temp11.html">fixed Box totally</a><a href="http://www.intensivstation.ch/files/en_templates/temp11.html">centered</a> and <a href="http://www.intensivstation.ch/files/en_templates/temp03.html">3 columns, all</a><a href="http://www.intensivstation.ch/files/en_templates/temp03.html">dynamic</a></p>
<p>23-<a href="http://layouts.ironmyers.com/">IM 布局</a>&#8211; IM 布局是一种简单地的CSS布局系统，IM布局提供了全A级的浏览器的支持。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts24.gif" alt="" width="450" height="250" /></p>
<p>你可以通过这里查看这些样例:<a href="http://www.ironmyers.com/examples/three_column_layout.html"> The Holy Grail 3 Column Layout</a>, <a href="http://www.ironmyers.com/examples/classic_blog.html">The Classic Blog Layout </a>和<a href="http://www.ironmyers.com/examples/multi_column.html"> The Multi Column Layout.</a></p>
<p>24-<a href="http://www.cssplay.co.uk/layouts/index.html">CSSplay </a>&#8211; CSS布局列表</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts25.gif" alt="" width="450" height="87" /></p>
<p>你可以通过这里查看这些样例:<a href="http://www.cssplay.co.uk/layouts/fixit.html">Cross browser FIXED</a>, <a href="http://www.cssplay.co.uk/layouts/threecol.html">Three columns</a> and <a href="http://www.cssplay.co.uk/layouts/frame.html">CSS Frame – The Holy Grill</a>.</p>
<p>25-<a href="http://blog.html.it/layoutgala/">Layoutgala </a>&#8211; 基于同样的的标记l得到最大数量的不同的布局方式。没有CCS hack，没有CSS workaround ，良好的浏览器兼容性。40种不同布局。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts26.gif" alt="" width="450" height="180" /></p>
<p>你可以通过这里查看这些样例:<a href="http://blog.html.it/layoutgala/LayoutGala07.html">Three fixed Columns</a>, <a href="http://blog.html.it/layoutgala/LayoutGala04.html">Three percentage columns</a> and <a href="http://blog.html.it/layoutgala/LayoutGala19.html">Liquid, three columns, hybrid widths </a>(吐槽：没有等高，不好看).</p>
<p>26-<a href="http://www.glish.com/css/">Glish</a>&#8211; 许多有用的跨浏览器布局技术</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts27.gif" alt="" width="450" height="125" /></p>
<p>你可以通过这里查看这些样例: <a href="http://www.glish.com/css/7.asp">3 columns, the holy grail</a>,<a href="http://www.glish.com/css/9.asp"> 2 columns, ALA style</a> and <a href="http://www.glish.com/css/2.asp">3 columns, all fluid </a></p>
<p>27-<a href="http://www.thenoodleincident.com/tutorials/box_lesson/boxes.html">Thenoodleincident</a>&#8211; CSS 从简单的单盒到3盒并增加一个顶部条，所有都是变宽。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts28.gif" alt="" width="450" height="140" /></p>
<p>28-<a href="http://www.bluerobot.com/web/layouts/">The Layout Reservoir</a>&#8211; 很多有用的CSS布局技术</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts30.gif" alt="" width="450" height="225" /></p>
<p>你可以通过这里查看这些样例:<a href="http://bluerobot.com/web/layouts/layout1.html"> 2 columns – left menu</a>,<a href="http://bluerobot.com/web/layouts/layout3.html"> 3 columns – flanking menus</a>和<a href="http://bluerobot.com/web/css/center1.html"> Auto-width Margins </a>.</p>
<p>29-<a href="http://www.strictlycss.com/articles/article/40/the-only-css-layout-you-need">The only CSS layout you need</a>&#8211; 在这篇文章中将会为你展现10个基于同一的HTML的不同的的布局。</p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts32.gif" alt="" width="450" height="225" /></p>
<p>你可以通过这里查看这些样例: <a href="http://www.strictlycss.com/examples/three-column-layout-1.asp"> Three column CSS layout – left and right menu</a>, <a href="http://www.strictlycss.com/examples/three-column-layout-2.asp">Two column CSS layout – top and left menu</a> 和 <a href="http://www.strictlycss.com/examples/three-column-layout-7.asp">Three column CSS fluid layout: 100% width</a></p>
<p>30-<a href="http://www.yaml.de/">另一个多栏布局</a>-是一个创建当代流行的变宽的浮动布局的XHTML/CSS框架。这是一个多功能实用的布局。</p>
<p>点击<a href="http://www.yaml.de/fileadmin/download/release_306/yaml_306_080609.zip">这里</a>下载.</p>
<p>31-<a href="http://www.cssliquid.com/">Liquid Designs</a>&#8211; 使用XHTML和CSS的变宽设计库。</p>
<h4><strong><span style="color: #008000;">最佳实践</span></strong></h4>
<p>如果你需要寻找一些布局灵感，你可以从下面的网站链接中找到。这些站点演示了CSS布局如何应用于不同类型的网站。查看这些网站是如何分成2栏或3栏，或混合宽栏和窄栏布局。</p>
<p>32-<a href="http://helldesign.net/">Helldesign</a></p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts5.jpg" alt="" width="450" height="365" /></p>
<p>33-<a href="http://silverbackapp.com/">Silverbackapp</a></p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts12.jpg" alt="" width="450" height="325" /></p>
<p>34-<a href="http://www.os.ca/accueil.php">OS communications informatiques</a></p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts13.jpg" alt="" width="450" height="310" /></p>
<p>35-<a href="http://rockatee.com/">Rockatee</a></p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts14.jpg" alt="" width="450" height="310" /></p>
<p>36-<a href="http://www.darrenhoyt.com/">Darrenhoyt</a></p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts15.jpg" alt="" width="450" height="225" /></p>
<p>37-<a href="http://www.makebetterwebsites.com/">Makebetterwebsites</a></p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts16.jpg" alt="" width="450" height="250" /></p>
<p>38-<a href="http://elitetheme.com/">Elitetheme</a></p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts17.jpg" alt="" width="450" height="250" /></p>
<p>39-<a href="http://www.studio7designs.com/">Studio7designs</a></p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts18.jpg" alt="" width="450" height="250" /></p>
<p>40-<a href="http://brightcreative.com/">Brightcreative</a></p>
<p><img decoding="async" loading="lazy" class="aligncenter" src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts19.jpg" alt="" width="450" height="300" /></p>
<p><em>(全文完)</em><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/14.jpg" alt="一些有意思的贴子和工具" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_title">一些有意思的贴子和工具</a></li><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/3013.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2010/09/biolab-150x150.jpg" alt="一些非常有意思的杂项资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3013.html" class="wp_rp_title">一些非常有意思的杂项资源</a></li><li ><a href="https://coolshell.cn/articles/1949.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/16.jpg" alt="Web中的省略号" width="150" height="150" /></a><a href="https://coolshell.cn/articles/1949.html" class="wp_rp_title">Web中的省略号</a></li><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/6840.html">CSS 布局:40个教程、技巧、例子和最佳实践</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/6840.html/feed</wfw:commentRss>
			<slash:comments>31</slash:comments>
		
		
			</item>
		<item>
		<title>Web开发中需要了解的东西</title>
		<link>https://coolshell.cn/articles/6043.html</link>
					<comments>https://coolshell.cn/articles/6043.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Wed, 07 Dec 2011 00:29:49 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[安全]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=6043</guid>

					<description><![CDATA[<p>在StackExchange上有人问了这样一个问题：What should every programmer know about web developmen...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/6043.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/6043.html">Web开发中需要了解的东西</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>在StackExchange上有人问了这样一个问题：<a href="http://programmers.stackexchange.com/questions/46716/what-should-every-programmer-know-about-web-development" target="_blank">What should every programmer know about web development?</a>（关于Web开发，什么是所有程序员需要知道的？）里面给出的答案非常不错，所以，我翻译转载过来。 顺便说一下，StackExchange真是非常好，大家可以对同一个答案做贡献和修订，看看这个问题的<a href="http://programmers.stackexchange.com/posts/46760/revisions" target="_blank">修订过程</a>你就知道了——专业的问答网站应该怎么去做。这就是我在这篇文章中也说过<a title="腾讯，竞争力 和 用户体验" href="https://coolshell.cn/articles/5901.html" target="_blank">真正的用户体验是什么样的</a>。</p>
<p>好了，下面是正文（我对原文做了一些批注，也许不对或有误导，请大家指正）</p>
<p>下面的这些东西可能对于大多数人并不陌生，但是可能会有些东西你以前并没有看过，或是没有完全搞懂，甚至都没有听说过。（陈皓注：我相信当你看完这个列表后，你会觉得对于我国的Web开发有点弱了，还是那句话，表面上的东西永远是肤浅的）</p>
<h4><strong>接口和用户体验</strong></h4>
<ul>
<li>小心浏览器的实现标准上的不一致，确信让你的网站能够适当地跨浏览器。至少，你的网站需要测试一下下面的浏览器：</li>
<ul>
<li>最新的 <a href="http://en.wikipedia.org/wiki/Gecko_%28layout_engine%29" rel="nofollow">Gecko</a> 引擎 (<a href="http://firefox.com/" rel="nofollow">Firefox</a>)，</li>
<li>一个 Webkit 引擎 (<a href="http://www.apple.com/safari/" rel="nofollow">Safari</a>, <a href="http://www.google.com/chrome" rel="nofollow">Chrome</a>, 或是其它的移动设备上的浏览器)</li>
<li> <a href="http://en.wikipedia.org/wiki/Internet_Explorer" rel="nofollow">IE 浏览器</a> (测试IE的兼容性你可以使用微软IE的 <a href="http://www.microsoft.com/Downloads/details.aspx?FamilyID=21eabb90-958f-4b64-b5f1-73d0a413c8ef&amp;displaylang=en" rel="nofollow">Application Compatibility VPC Images</a>)</li>
<li> <a href="http://www.opera.com/" rel="nofollow">Opera</a> 浏览器。</li>
</ul>
</ul>
<p style="padding-left: 30px;">最后，你可以使用一下<a href="http://www.browsershots.org/" rel="nofollow">这个工具</a> 来看看你的网页在不同的浏览器下是怎么被显示出来的（陈皓注：这个工具就是以前本站介绍过的<a title="如何检查网页浏览器的兼容性" href="https://coolshell.cn/articles/757.html" target="_blank">在不同浏览器和平台上检查你的网站的兼容性</a>）</p>
<ul>
<li>多考虑一下人们是怎么来访问你的网站而不是那些主流的浏览器：手机，读屏软件和搜索引擎，例如：一些Accessibility的东西： <a href="http://www.w3.org/WAI/" rel="nofollow">WAI</a> 和  <a href="http://www.section508.gov/" rel="nofollow">Section508</a>, 移动设备开发：<a href="http://mobiforge.com/" rel="nofollow">MobiForge</a>.</li>
</ul>
<ul>
<li>部署Staging：怎么部署网站的更新而不会影响用户的访问。 <a href="http://programmers.stackexchange.com/questions/46716/what-should-a-developer-know-before-building-a-public-web-site/46738#46738">Ed Lucas的答案</a> 可以让你了解一些（陈皓注：Ed说了一些如版本控制，自动化build，备份，回滚等机制）。</li>
</ul>
<ul>
<li>千万不要直接给用户显示不友好的错误信息。</li>
</ul>
<div><span id="more-6043"></span></div>
<ul>
<li>千万不要把用户的邮件地址以明文显示出来，这样会被爬虫爬走并被让用户的邮箱被垃圾邮件搞死。</li>
</ul>
<ul>
<li>为用户的链接加上 <code>rel="nofollow"</code> 的属性以 <a href="http://en.wikipedia.org/wiki/Nofollow" rel="nofollow">避免垃圾网站的干扰</a>。（陈皓注：<strong>nofollow</strong>是HTML的一个属性，用于通知搜索引擎“这个链接所指向的网页非我所能控制，对其内容不予置评”，或者简单地说，该链接不是对目标网站或网页的“投票”，这样搜索引擎不会再访问这个链接。这个是用来减少一些特定垃圾页面对原网站的影响，从而可以改善搜索结果的质量，并且防止垃圾链接的蔓延。）</li>
</ul>
<ul>
<li><a href="http://www.codinghorror.com/blog/archives/001228.html" rel="nofollow">为网站建立一些的限制</a> &#8211; 这个属于安全性的范畴。（陈皓注：比如你在Google注册邮箱时，你一口气注册超过两个以上的邮箱，gmail要求给你发短信或是给你打电话认证，比如Discuz论坛的会限制你发贴或是搜索的间隔时间等等，更多的网站会用CAPTCHA来确认是人为的操作。 这些限制都是为了防止垃圾和恶意攻击）</li>
</ul>
<ul>
<li>学习如何做 <a href="http://en.wikipedia.org/wiki/Progressive_enhancement" rel="nofollow">Progressive Enhancement</a>. （陈皓注：<a href="http://en.wikipedia.org/wiki/Progressive_enhancement" rel="nofollow">Progressive Enhancement</a>是一个Web Design的理念，如：1）基础的内容和功能应该可以被所有的浏览器存取，2）页面布局的应该使用外部的CSS链接，3）Javascript也应该是外部链接还应该是 <a title="Unobtrusive JavaScript" href="http://en.wikipedia.org/wiki/Unobtrusive_JavaScript">unobtrusive</a> 的，4）应该让用户可以设置他们的偏好）</li>
</ul>
<ul>
<li>如果POST成功，要<a href="http://en.wikipedia.org/wiki/Post/Redirect/Get" rel="nofollow">在POST方法后重定向网址</a>，这样可以阻止用户通过刷新页面重复提交。</li>
</ul>
<ul>
<li>严重关注Accessibility。因为这是<a href="http://www.section508.gov/" target="_blank">法律上的需求</a>（陈皓注：Section 508是美国的508法案，其是美国劳工复健法的改进，它是一部联邦法律，这个法律要求所有技术要考虑到残障人士的应用，如果某个大众信息传播网站，如果某些用户群体（如残疾人）浏览该网站获取信息时，如果他们无法正常获得所期望的信息（如无法正常浏览），那可以依据相关法规，可以对该网站依法起诉）。 <a href="http://www.w3.org/WAI/intro/aria" rel="nofollow">WAI-ARIA</a> 为这方面的事提供很不错的资源.</li>
</ul>
<h4><strong>安全</strong></h4>
<ul>
<li>在网上有很多关于安全的文章，但是 <a href="http://www.owasp.org/index.php/Category%3aOWASP_Guide_Project" rel="nofollow">OWASP 开发指导</a> 涵盖了几乎所有关于Web站点安全的东西。（陈皓注：OWASP(开放Web应用安全项目- Open Web Application Security Project)是一个开放的非营利性组织，目前全球有130个分会近万名会员，其主要目标是研议协助解决Web软体安全之标准、工具与技术文件，长期 致力于协助政府或企业了解并改善网页应用程式与网页服务的安全性。OWASP被视为Web应用安全领域的权威参考。2009年下列发布的美国国家和国际立法、标准、准则、委员会和行业实务守则参考引用了OWASP。美国联邦贸易委员会(FTC)强烈建议所有企业需遵循OWASP十大WEB弱点防护守则）</li>
</ul>
<ul>
<li>了解什么是 <a href="http://en.wikipedia.org/wiki/SQL_injection" rel="nofollow">SQL 注入攻击</a> 并知道怎么阻止这种攻击。</li>
</ul>
<ul>
<li>永远不要相信用户的输入（包括Cookies，因为那也是用户的输入）</li>
</ul>
<ul>
<li>对用户的口令进行Hash，并使用salt，以防止Rainbow 攻击（陈皓注：Hash算法可用MD5或SHA1等，对口令使用salt的意思是，user 在设定密码时，system 产生另外一个random string(salt)。在datbase 存的​​是与salt + passwd 产的md5sum 及salt。 当要验证密码时就把user 输入的string 加上使用者的salt，产生md5s​​um 来比对。 理论上用salt 可以大幅度让密码更难破解，相同的密码除非刚好salt 相同，最后​​存在database 上的内容是不一样的。google一下md5+salt你可以看到很多文章。关于<a href="http://en.wikipedia.org/wiki/Rainbow_table" target="_blank">Rainbow 攻击</a>，其意思是很像密码字典表，但不同的是，Rainbow Table存的是已经被Hash过的密码了，而且其查找密码的速度更快，这样可以让攻击非常快）。使用慢一点的Hash算法来保存口令，如 bcrypt (被时间检证过了) 或是 scrypt (更强，但是也更新一些) (<a href="http://www.tarsnap.com/scrypt.html" rel="nofollow">1</a>, <a href="http://it.slashdot.org/comments.pl?sid=1987632&amp;cid=35149842" rel="nofollow">2</a>)。你可以阅读一下 <a href="http://codahale.com/how-to-safely-store-a-password/" rel="nofollow">How To Safely Store A Password</a>（陈皓注：酷壳以前曾介绍过<a title="如何防范密码被破解" href="https://coolshell.cn/articles/2078.html" target="_blank">bcrypt这个算法</a>，这里，我更建议我们应该让用户输入比较强的口令，比如Apple ID注册的过程需要用户输入超过8位，需要有大小写和数字的口令，或是做出类似于<a title="另类UX让你输入强口令" href="https://coolshell.cn/articles/3877.html" target="_blank">这样的用户体验的东西</a>）。</li>
</ul>
<ul>
<li><a href="http://stackoverflow.com/questions/1581610/how-can-i-store-my-users-passwords-safely/1581919#1581919">不要试图自己去发明或创造一个自己的fancy的认证系统</a>，你可能会忽略到一些不容易让你查觉的东西而导致你的站点被hack了。（陈皓注：我在<a title="如何设计“找回用户帐号”功能" href="https://coolshell.cn/articles/5987.html" target="_blank">腾讯那坑爹的申诉系统</a>中说过这个事了，我说过这句话——“真正的安全系统是协同整个社会的安全系统做出来的一道安全长城，而不是什么都要自己搞”，当然，很遗憾不是所有的人都能看懂这个事，包括一些资深的人）</li>
</ul>
<ul>
<li>了解 <a href="https://www.pcisecuritystandards.org/" rel="nofollow">处理信用卡的一些规则 </a>. (<a href="http://stackoverflow.com/questions/51094/payment-processors-what-do-i-need-to-know-if-i-want-to-accept-credit-cards-on-m">这里也有一个问题你可以查看一下</a>) （陈皓注：有两上vendor可以帮助你，一个是 <a href="http://www.authorize.net/" rel="nofollow">Authorize.Net</a> 另一个是 <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_payflow-pro-overview-outside" rel="nofollow">PayFlow Pro</a>）</li>
</ul>
<ul>
<li>使用 <a href="http://www.mozilla.org/projects/security/pki/nss/ssl/draft302.txt" rel="nofollow">SSL</a>/<a href="http://en.wikipedia.org/wiki/Https" rel="nofollow">HTTPS</a> 来加密传输登录页面或是任可有敏感信息的页面，比如信用卡号等。</li>
</ul>
<ul>
<li>知道如何对付session 劫持。（陈皓注：请参看wikipedia的这<a href="http://en.wikipedia.org/wiki/Session_hijacking" target="_blank">Session Hijacking</a>，）</li>
</ul>
<ul>
<li>避免 <a href="http://en.wikipedia.org/wiki/Cross-site_scripting" rel="nofollow">跨站脚本攻击</a>(XSS)。（陈皓注：参看酷壳站前几天发的《<a title="新浪微博的XSS攻击" href="https://coolshell.cn/articles/4914.html" target="_blank">新浪微博的XSS攻击事件</a>》）</li>
</ul>
<ul>
<li>避免 <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" rel="nofollow">跨站</a><a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" rel="nofollow">伪造</a><a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery" rel="nofollow">请求攻击 cross site request forgeries</a> (XSRF).</li>
</ul>
<ul>
<li>保持你的系统里的所有软件更新到最新的patch。</li>
</ul>
<ul>
<li>确保你的数据库连接是安全的。</li>
</ul>
<ul>
<li>确保你能了解最新的攻击技术，以及你系统的脆弱处。</li>
</ul>
<ul>
<li>请读一下 <a href="http://code.google.com/p/browsersec/wiki/Main" rel="nofollow">The Google Browser Security Handbook</a>.</li>
</ul>
<ul>
<li>请读一下 <a href="http://rads.stackoverflow.com/amzn/click/0470170778" rel="nofollow">The Web Application Hacker&#8217;s Handbook</a>.</li>
</ul>
<ul>
<li>（陈皓注：之前本站的“<a title="一些文章资源和趣闻" href="https://coolshell.cn/articles/5537.html" target="_blank">一些资源</a>”提到过<a href="https://wiki.mozilla.org/WebAppSec/Secure_Coding_Guidelines" target="_blank">Mozilla的安全编程规范</a>，还有Ruby on Rails的<a href="http://guides.rubyonrails.org/security.html" target="_blank">Web安全的开发教程</a>）</li>
</ul>
<h4><strong>性能</strong></h4>
<ul>
<li>只要需要，请实现cache机制，了解并合理地使用 <a href="http://www.mnot.net/cache_docs/" rel="nofollow">HTTP caching</a> 以及 <a href="http://www.w3.org/TR/html5/offline.html" rel="nofollow">HTML5 Manifest</a>.</li>
</ul>
<ul>
<li>优化页面 —— 不要使用20KB图片来平铺网页背景。（陈皓注：还有很多网页页面优化性的文章，你可以STFG &#8211; Search The Fucking Google一下。如果你要调试的话，你可以使用firebug或是chrome内置的开发人员的工具来查看网页装载的性能）</li>
<li>学习如何 <a title="gzip content" href="http://developer.yahoo.com/performance/rules.html#gzip" rel="nofollow">gzip/deflate 网页</a> (<a href="http://stackoverflow.com/questions/1574168/gzip-vs-deflate-zlib-revisited">deflate 更好</a>).</li>
</ul>
<ul>
<li>把多个CSS文件和Javascript文件合并成一个，这样可以减少浏览器的网络连数，并且使用gzip压缩被反复用到的文件。</li>
</ul>
<ul>
<li>学习一下 <a href="http://developer.yahoo.com/performance/" rel="nofollow">Yahoo Exceptional Performance</a> 这个网站上的东西，上面有很多非常不错的改善前端性能的指导，以及 <a href="http://developer.yahoo.com/yslow/" rel="nofollow">YSlow</a> 这个工具。 <a href="http://code.google.com/speed/page-speed/docs/rules_intro.html" rel="nofollow">Google page speed</a> 是另一个用来做性能采样的工具。这两个工具都需要安装 <a href="http://getfirebug.com/" rel="nofollow">Firebug</a> 。</li>
</ul>
<ul>
<li>为那些小的图片使用 <a href="http://alistapart.com/articles/sprites" rel="nofollow">CSS Image Sprites</a>，就像工具条一样。 (参看 &#8220;最小化 HTTP 请求&#8221; ) （陈皓注：把所有的小图片合并成一个图片，然后用CSS把显示其中的一块，这样，这些小图片只用传输一次，酷壳的Wordpress样式的那个RSS订阅列表中的小图标就是这样做的）</li>
</ul>
<ul>
<li>繁忙的网络应该考虑<a href="http://developer.yahoo.com/performance/rules.html#split" target="_blank">把网页的内容分开存放</a>在不同的域名下。（陈皓注：比如有专门的图片服务器——图片相当耗带宽，或是专门的Ajax服务器）</li>
</ul>
<ul>
<li>静态网页 (如，图片，CSS，JavaScript，以及一些不需要访问cookies的网页) 应该放在一个<a href="http://blog.stackoverflow.com/2009/08/a-few-speed-improvements/" target="_blank">不使用cookies</a>的独立的域名下，因为所有在同一个域名或子域名下的cookie会被这个域名下的请求一同发送。另一个好的选择是使用 Content Delivery Network (CDN).</li>
</ul>
<ul>
<li>使用单个页面的HTTP请求数最小化。</li>
</ul>
<ul>
<li>为Javascript使用 <a href="http://code.google.com/closure/compiler/" rel="nofollow">Google Closure Compiler</a> 或是 <a href="http://developer.yahoo.com/yui/compressor/" rel="nofollow">其它压缩工具</a>（陈皓注：压缩Javascript代码可以让你的页面减少网络传输从而可以得到很快的喧染。注意，并不是所有的工具都可以正确压缩Javascript的，Google的这个工具甚至还可以帮你优化你的代码）</li>
</ul>
<ul>
<li>确认你的网站有一个 <code>favicon.ico</code> 文件放在网站的根下，如 <code>/favicon.ico</code>. <a href="http://mathiasbynens.be/notes/rel-shortcut-icon" rel="nofollow">浏览器会自动请求这个文件</a>，就算这个图标文件没有在你的网页中明显说明，浏览器也会请求。如果你没有这个文件，就会出大量的404错误，这会消耗你的服务器带宽。（陈皓注：服务器返回404页面会比这个ico文件可能还大）</li>
</ul>
<h4><strong>SEO (搜索引擎优化)</strong></h4>
<ul>
<li>使用 &#8220;搜索引擎喜欢的&#8221; URL，如：使用 <code>example.com/pages/45-article-title</code> 而不是 <code>example.com/index.php?page=45 </code>(陈皓注：这里的URL是说Wordpress的，后者是默认的)</li>
</ul>
<ul>
<li>如果你的动态页面要使用 <code>#</code> ，那么请把其改成 <code>#!</code> ，而在服务端，你需要处理<code>$_REQUEST["_escaped_fragment_"]</code> 这是Google搜索引擎需要的。换句话说，<code>./#!page=1</code> 会被Google搜索引擎转成 <code>./?_escaped_fragments_=page=1。</code> （陈皓注：通常来说URL中的#后的东西都不会被传到服务器上，所以，为了要让Google可以抓取AJAX的东西，你需要使用#!，而Google会把“#!”转成“_escaped_fragment_”来向服务器发请求，Twitter的大量的链接者是#!的，比如：<a href="https://twitter.com/#!/your_activity">https://twitter.com/#!/your_activity</a>）。另外，用户也许会使用Firefox 或 Chromium， <code>history.pushState({"foo":"bar"}, "About", "./?page=1");</code> 是一个很不错的命令。所以，就算是我们的地址栏上的地址改变了，页面也不会重新装载。这可以让你使用 <code>?</code> 而不是 <code>#!</code> 也能无刷地保住当前的动态的页面，这可以让AJAX的请求被浏览器记住。</li>
</ul>
<ul>
<li>别使用 &#8220;click here&#8221; 这样的链接。这样一来，无法SEO，而且对于一些需要使用读屏人来说很不友好（陈皓注：关于读屏软件，可参看本站的“<a title="如果你看不见你还能编程吗？" href="https://coolshell.cn/articles/5514.html" target="_blank">如果看不见你还能编程吗</a>”）</li>
</ul>
<ul>
<li>做一个 <a href="http://www.sitemaps.org/" rel="nofollow">XML sitemap</a>，并放在网端的根下 <code>/sitemap.xml</code>. （陈皓注：这个文件可以让搜索引擎了解你的网站图）</li>
<li>当你有多个URL指向同一个网页的使用，使用 <a href="http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html" rel="nofollow"><code>&lt;link rel="canonical" ... /&gt;</code></a> 你可以使用 <a href="http://www.google.com/webmasters/" rel="nofollow">Google Webmaster Tools</a> 来查看相关的问题。</li>
</ul>
<ul>
<li>使用 <a href="http://www.google.com/webmasters/" rel="nofollow">Google Webmaster Tools</a> 和 <a href="http://siteexplorer.search.yahoo.com/" rel="nofollow">Yahoo Site Explorer</a>.</li>
</ul>
<ul>
<li>安装 <a href="http://www.google.com/analytics/" rel="nofollow">Google Analytics</a>  (或是别的开源的网站分析工具，如： <a href="http://piwik.org/" rel="nofollow">Piwik</a>).</li>
</ul>
<ul>
<li>了解 <a href="http://en.wikipedia.org/wiki/Robots_exclusion_standard" rel="nofollow">robots.txt</a> 和搜索引擎爬虫是如何工作的。</li>
</ul>
<ul>
<li>重定向请求 (使用 <code>301 重定向网站</code>) ，如果你要把 <code>www.example.com</code> 定向到 <code>example.com</code>(或是其它的变更) 这样可以防止Google的rank因为域名的变化发生改变。（陈皓注：301重定向一般用作域名变更）</li>
</ul>
<ul>
<li>知道并不是所有的爬虫都是好的，有些爬虫的行为并不好。（陈皓注：比如向你的网站发大量的请求导致服务器性能低下）</li>
</ul>
<ul>
<li>如果你有一些非文本的内容需要在 Google&#8217;s sitemap  中，比如视频什么的。<a href="http://stackoverflow.com/questions/72394/what-should-a-developer-know-before-building-a-public-web-site#167608">Tim Farley的答案</a>，可以让你看到很多有价值的东西。</li>
</ul>
<h4><strong>技术</strong></h4>
<ul>
<li>理解什么是 <a href="http://www.ietf.org/rfc/rfc2616.txt" rel="nofollow">HTTP</a> 比如 GET, POST, sessions, cookies等，了解什么是 &#8220;stateless&#8221; 无状态。</li>
</ul>
<ul>
<li>让你的 <a href="http://www.w3.org/TR/xhtml1/" rel="nofollow">XHTML</a>/<a href="http://www.w3.org/TR/REC-html40/" rel="nofollow">HTML</a> 和 <a href="http://www.w3.org/TR/CSS2/" rel="nofollow">CSS</a> 符合 <a href="http://www.w3.org/TR/" rel="nofollow">W3C 规范</a>，并确认他们都是 <a href="http://validator.w3.org/" rel="nofollow">合格的</a>。我们的目标是避免浏览器的 “quirks mode”，并且可以让其更容易地能和非标准的浏览器工作，比如读屏器或移动设备。</li>
</ul>
<ul>
<li>理解浏览器是怎么处理 JavaScript 的。（陈皓：你会看到有些Javascript代码在页面上前面，有些则是在后面，所以你需要对其了解清楚为什么是这样）</li>
</ul>
<ul>
<li>了解浏览器是怎么装载 JavaScript，CSS和其它资源的，了解其对视觉上的影响。（陈皓注：10年前我做网页的时候因为HTML还很弱，所以只能使用table来布局，使用table布局的问题就是整个table读完后页面才会显示，用户的视觉体验并不好）。在某些情况下，你可能需要<a href="http://developer.yahoo.net/blog/archives/2007/07/high_performanc_5.html" target="_blank">把你的脚本放在页面的后面</a>。</li>
</ul>
<ul>
<li>理解 JavaScript 的 sandbox 是怎么怎么工作的，尤其是你想使用iframes。</li>
</ul>
<ul>
<li>请注意 JavaScript 可能会被禁止，这样会让你的AJAX失效。就算是大多数用户都开启了Javascript功能，但是也可能在一些情况下脚本是不被运行的，比如移动终端上，搜索引擎抓网页的时候也并不会执行你的脚本。</li>
</ul>
<ul>
<li>学习 <a href="http://www.bigoakinc.com/blog/when-to-use-a-301-vs-302-redirect/" rel="nofollow">301 和 302 转向的区别</a> (这也是一个SEO的问题).</li>
</ul>
<ul>
<li>尽可能多地学习你的部署平台。（比如：操作系统，Web Server：Apache/Nginx，防火墙，数据库，等等）</li>
</ul>
<ul>
<li>考虑使用一个 <a href="http://stackoverflow.com/questions/167531/is-it-ok-to-use-a-css-reset-stylesheet">Reset Style Sheet</a>.</li>
</ul>
<ul>
<li>考虑使用 JavaScript 框架(如： <a href="http://jquery.com/" rel="nofollow">jQuery</a>, <a href="http://mootools.net/" rel="nofollow">MooTools</a>, <a href="http://www.prototypejs.org/" rel="nofollow">Prototype</a>, <a href="http://dojotoolkit.org/" rel="nofollow">Dojo</a> 或 <a href="http://developer.yahoo.com/yui/3/" rel="nofollow">YUI 3</a>)，它们会很好的兼容于不同的浏览器。（陈皓注：强烈推荐你看一下本站的<a title="开源中最好的Web开发的资源" href="https://coolshell.cn/articles/4795.html" target="_blank">开源中最好的WEB开发资源</a>一文）</li>
</ul>
<ul>
<li>把视觉效果和JS框架合在一起讨论，考虑使用一个Service，如：<a href="http://code.google.com/apis/libraries/devguide.html" rel="nofollow">Google Libraries API</a> 来装载框架，这样可以让浏览器可能早就把这个JS框架已经cache了而不需要再从你的网站上下载了。</li>
</ul>
<h4><strong>Bug fixing</strong></h4>
<ul>
<li>明白你会花20%的时间写代码，而80%的时候在维护，所以你要小心编码。（陈皓注：参看本站的“<a title="多些时间能少写些代码" href="https://coolshell.cn/articles/5686.html" target="_blank">多些时间可以少些代码</a>”一文）</li>
</ul>
<ul>
<li>设计一个好的错误报告机制。</li>
</ul>
<ul>
<li>设计一个入口可以让人们联系到你并给你建议和批评。</li>
</ul>
<ul>
<li>为你开发的东西形成文档，这样可以让后来的人容易维护你的软件和系统。</li>
</ul>
<ul>
<li>频繁备份（也可确保你的这些备份功能正常） <a href="http://stackoverflow.com/questions/72394/what-should-a-developer-know-before-building-a-public-web-site#73970">Ed Lucas 的回答</a> 有一些忠告。你还需要有一个恢复策略，而不只是一个备份策略。</li>
</ul>
<ul>
<li>使用一个版本控制系统来保存你的代码，如： <a href="http://subversion.apache.org/" rel="nofollow">Subversion</a> 或 <a href="http://git-scm.org/" rel="nofollow">Git</a>.</li>
</ul>
<ul>
<li>别忘了做Acceptance Testing，使用 <a href="http://seleniumhq.org/" rel="nofollow">Selenium</a> 能帮到你。</li>
</ul>
<ul>
<li>确保你有足够的日志，你可以使用 log4j, log4n 或 log4r。如果出了问题，这是可以让你快速找到问题的方式。</li>
</ul>
<ul>
<li>当你写日志的时候，确保你记录了你捕获了处理和未处理异常。报告和分析日志可以让你知道你网站的问题。</li>
</ul>
<p>这里有多的东西被省略了，并不是因为那些可能不是有帮助的答案，而是因为那些东西都太细节了，超出了这个问题的范围，因为这本来就是一个Web开发需要了解东西的Overview。我想你可以去看一下其它人的答案，我有时间，我也会补充别人的答案进来。请随意编辑这个答案，因为可能有些东西忘了，也有可能有些东西不对。</p>
<p style="text-align: left;">（全文完）</p>
<p><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/18360.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2018/05/300x262-150x150.jpg" alt="程序员练级攻略（2018)  与我的专栏" width="150" height="150" /></a><a href="https://coolshell.cn/articles/18360.html" class="wp_rp_title">程序员练级攻略（2018)  与我的专栏</a></li><li ><a href="https://coolshell.cn/articles/18094.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/08/enable-https-banner-150x150.png" alt="如何免费的让网站启用HTTPS" width="150" height="150" /></a><a href="https://coolshell.cn/articles/18094.html" class="wp_rp_title">如何免费的让网站启用HTTPS</a></li><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/11021.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2014/02/Github-Security-150x150.png" alt="从“黑掉Github”学Web安全开发" width="150" height="150" /></a><a href="https://coolshell.cn/articles/11021.html" class="wp_rp_title">从“黑掉Github”学Web安全开发</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/6043.html">Web开发中需要了解的东西</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/6043.html/feed</wfw:commentRss>
			<slash:comments>150</slash:comments>
		
		
			</item>
		<item>
		<title>CSS图形</title>
		<link>https://coolshell.cn/articles/5164.html</link>
					<comments>https://coolshell.cn/articles/5164.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Mon, 15 Aug 2011 00:21:50 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Shape]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=5164</guid>

					<description><![CDATA[<p>下面的示例展示了使用纯CSS制作的各种图形，你可以自由地修改文中的CSS代码。这个收集的原文在这里。 经测试，IE9, Chrome, FF, Safari都可...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/5164.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/5164.html">CSS图形</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script></p>
<p>下面的示例展示了使用纯CSS制作的各种图形，你可以自由地修改文中的CSS代码。这个收集的<a href="http://css-tricks.com/examples/ShapesOfCSS/?=derp" target="_blank">原文在这里</a>。</p>
<p> 经测试，IE9, Chrome, FF, Safari都可以正常显示。</p>
<style type="text/css">
.shape {
    padding: 20px;
}
.shape > style {
    display: block;
    white-space: pre;
    background: #333;
    color: white;
    font: 12px Monaco;
    padding: 0 15px;
}
.shape > div {
    margin: 20px ;
}
.shape > h5 {
    border-style:none none double none;
    /*padding: 10px;
    text-indent: 60px;
    margin: 50px 0 0 -70px;*/
    position: relative;
    font: bold italic 20px "atrament-web-1","atrament-web-2", Georgia, Serif;
    color:#333;
}
.shape > h5 > a {
    position: absolute;
    right: 20px;
    bottom: 10px;
    font-size: 20px;
}
</style>
<div class="shape">
<h5>正方形</h5>
<div id="square"></div>
<style contenteditable> 
#square {
	width: 100px;
	height: 100px;
	background: #f66;
}
            </style>
</p>
</div>
<div class="shape">
<h5>长方形</h5>
<div id="rectangle"></div>
<style contenteditable> 
#rectangle {
	width: 200px;
	height: 100px;
	background: #f66;
}
            </style>
</p>
</div>
<p><span id="more-5164"></span>                </p>
<div class="shape">
<h5>圆形</h5>
<div id="circle"></div>
<style contenteditable> 
#circle {
	width: 100px;
	height: 100px;
	background: #f66;
	-moz-border-radius: 50px;
	-webkit-border-radius: 50px;
	border-radius: 50px;
}
            </style>
</p>
</div>
<div class="shape">
<h5>椭圆形</h5>
<div id="oval"></div>
<style contenteditable> 
#oval {
	width: 200px;
	height: 100px;
	background: #f66;
	-moz-border-radius: 100px / 50px;
	-webkit-border-radius: 100px / 50px;
	border-radius: 100px / 50px;
}
            </style>
</p>
</div>
<div class="shape">
<h5>三角形（向上）</h5>
<div id="triangle-up"></div>
<style contenteditable> 
#triangle-up {
	width: 0;
	height: 0;
	border-left: 50px solid transparent;
	border-right: 50px solid transparent;
	border-bottom: 100px solid #f66;
}
            </style>
</p>
</div>
<div class="shape">
<h5>三角形（向下）</h5>
<div id="triangle-down"></div>
<style contenteditable> 
#triangle-down {
	width: 0;
	height: 0;
	border-left: 50px solid transparent;
	border-right: 50px solid transparent;
	border-top: 100px solid #f66;
}				
            </style>
</p>
</div>
<div class="shape">
<h5>三角形（向左）</h5>
<div id="triangle-left"></div>
<style contenteditable> 
#triangle-left {
	width: 0;
	height: 0;
	border-top: 50px solid transparent;
	border-right: 100px solid #f66;
	border-bottom: 50px solid transparent;
}
            </style>
</p>
</div>
<div class="shape">
<h5>三角形（向右）</h5>
<div id="triangle-right"></div>
<style contenteditable> 
#triangle-right {
	width: 0;
	height: 0;
	border-top: 50px solid transparent;
	border-left: 100px solid #f66;
	border-bottom: 50px solid transparent;
}</style>
</p>
</div>
<div class="shape">
<h5>三角形（左上）</h5>
<div id="triangle-topleft"></div>
<style contenteditable> 
#triangle-topleft {
	width: 0;
	height: 0;
	border-top: 100px solid #f66; 
	border-right: 100px solid transparent;			
}
            </style>
</p>
</div>
<div class="shape">
<h5>三角形（右上）</h5>
<div id="triangle-topright"></div>
<style contenteditable> 
#triangle-topright {
	width: 0;
	height: 0;
	border-top: 100px solid #f66; 
	border-left: 100px solid transparent;
}
</style>
</p>
</div>
<div class="shape">
<h5>三角形（左下）</h5>
<div id="triangle-bottomleft"></div>
<style contenteditable> 
#triangle-bottomleft {
	width: 0;
	height: 0;
	border-bottom: 100px solid #f66; 
	border-right: 100px solid transparent;	
}		
            </style>
</p>
</div>
<div class="shape">
<h5>三角形（右下）</h5>
<div id="triangle-bottomright"></div>
<style contenteditable> 
#triangle-bottomright {
	width: 0;
	height: 0;
	border-bottom: 100px solid #f66; 
	border-left: 100px solid transparent;
}				
            </style>
</p>
</div>
<div class="shape">
<h5>平行四边行</h5>
<div id="parallelogram"></div>
<style contenteditable> 
#parallelogram {
	width: 150px;
	height: 100px;
	-webkit-transform: skew(20deg);
	   -moz-transform: skew(20deg);
	     -o-transform: skew(20deg);
	background: #f66;
}
            </style>
</p>
</div>
<div class="shape">
<h5>梯形</h5>
<div id="trapezoid"></div>
<style contenteditable> 
#trapezoid {
	border-bottom: 100px solid #f66;
	border-left: 50px solid transparent;
	border-right: 50px solid transparent;
	height: 0;
	width: 100px;
}
            </style>
</p>
</div>
<div class="shape">
<h5>六角星形</h5>
<div id="star-six"></div>
<style contenteditable> 
#star-six {
	width: 0;
	height: 0;
	border-left: 50px solid transparent;
	border-right: 50px solid transparent;
	border-bottom: 100px solid #f66;
	position: relative;
        margin: 20px 0px 50px 20px;
}
#star-six:after {
	width: 0;
	height: 0;
	border-left: 50px solid transparent;
	border-right: 50px solid transparent;
	border-top: 100px solid #f66;
	position: absolute;
	content: "";
	top: 30px;
	left: -50px;
}
            </style>
</p>
</div>
<div class="shape">
<h5>五角星形 <a href="http://kitmacallister.com/2011/css-only-5-point-star/">via Kit MacAllister</a></h5>
<div id="star-five"></div>
<style contenteditable> 
#star-five {
   margin: 80px 0;
   position: relative;
   display: block;
   color: #f66;
   width: 0px;
   height: 0px;
   border-right:  100px solid transparent;
   border-bottom: 70px  solid #f66;
   border-left:   100px solid transparent;
   -moz-transform:    rotate(35deg);
   -webkit-transform: rotate(35deg);
   -ms-transform:     rotate(35deg);
   -o-transform:      rotate(35deg);
}
#star-five:before {
   border-bottom: 80px solid #f66;
   border-left: 30px solid transparent;
   border-right: 30px solid transparent;
   position: absolute;
   height: 0;
   width: 0;
   top: -45px;
   left: -65px;
   display: block;
   content: '';
   -webkit-transform: rotate(-35deg);
   -moz-transform:    rotate(-35deg);
   -ms-transform:     rotate(-35deg);
   -o-transform:      rotate(-35deg);
}
#star-five:after {
   position: absolute;
   display: block;
   color: #f66;
   top: 3px;
   left: -105px;
   width: 0px;
   height: 0px;
   border-right: 100px solid transparent;
   border-bottom: 70px solid #f66;
   border-left: 100px solid transparent;
   -webkit-transform: rotate(-70deg);
   -moz-transform:    rotate(-70deg);
   -ms-transform:     rotate(-70deg);
   -o-transform:      rotate(-70deg);
   content: '';
}
            </style>
</p>
</div>
<div class="shape">
<h5>五边形</h5>
<div id="pentagon"></div>
<style contenteditable> 
#pentagon {
    position: relative;
    width: 54px;
    border-width: 50px 18px 0;
    border-style: solid;
    border-color: #f66 transparent;
    margin: 50px 0px 20px 20px;
}
#pentagon:before {
    content: "";
    position: absolute;
    height: 0;
    width: 0;
    top: -85px;
    left: -18px;
    border-width: 0 45px 35px;
    border-style: solid;
    border-color: transparent transparent #f66;
}
            </style>
</p>
</div>
<div class="shape">
<h5>六边形</h5>
<div id="hexagon"></div>
<style contenteditable> 
#hexagon {
	width: 100px;
	height: 55px;
	background: #f66;
	position: relative;
        margin: 50px 0px 50px 20px;
}
#hexagon:before {
	content: "";
	position: absolute;
	top: -25px; 
	left: 0;
	width: 0;
	height: 0;
	border-left: 50px solid transparent;
	border-right: 50px solid transparent;
	border-bottom: 25px solid #f66;
}
#hexagon:after {
	content: "";
	position: absolute;
	bottom: -25px; 
	left: 0;
	width: 0;
	height: 0;
	border-left: 50px solid transparent;
	border-right: 50px solid transparent;
	border-top: 25px solid #f66;
}</style>
</div>
<div class="shape">
<h5>八边形</h5>
<div id="octagon"></div>
<style contenteditable> 
#octagon {
	width: 100px;
	height: 100px;
	background: #f66;
	position: relative;
}
#octagon:before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;    
	border-bottom: 29px solid #f66;
	border-left: 29px solid #fff;
	border-right: 29px solid #fff;
	width: 42px;
	height: 0;
}
#octagon:after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;    
	border-top: 29px solid #f66;
	border-left: 29px solid #fff;
	border-right: 29px solid #fff;
	width: 42px;
	height: 0;
}
            </style>
</p>
</div>
<div class="shape">
<h5>心形 <a href="http://nicolasgallagher.com/">via Nicolas Gallagher</a></h5>
<div id="heart"></div>
<style contenteditable> 
#heart {
    position: relative;
    width: 100px;
    height: 90px;
}
#heart:before,
#heart:after {
    position: absolute;
    content: "";
    left: 50px;
    top: 0;
    width: 50px;
    height: 80px;
    background: #f66;
    -moz-border-radius: 50px 50px 0 0;
    border-radius: 50px 50px 0 0;
    -webkit-transform: rotate(-45deg);
       -moz-transform: rotate(-45deg);
        -ms-transform: rotate(-45deg);
         -o-transform: rotate(-45deg);
            transform: rotate(-45deg);
    -webkit-transform-origin: 0 100%;
       -moz-transform-origin: 0 100%;
        -ms-transform-origin: 0 100%;
         -o-transform-origin: 0 100%;
            transform-origin: 0 100%;
}
#heart:after {
    left: 0;
    -webkit-transform: rotate(45deg);
       -moz-transform: rotate(45deg);
        -ms-transform: rotate(45deg);
         -o-transform: rotate(45deg);
            transform: rotate(45deg);
    -webkit-transform-origin: 100% 100%;
       -moz-transform-origin: 100% 100%;
        -ms-transform-origin: 100% 100%;
         -o-transform-origin: 100% 100%;
            transform-origin :100% 100%;
}
</style>
</p>
</div>
<div class="shape">
<h5>无穷大 <a href="http://nicolasgallagher.com/">via Nicolas Gallagher</a></h5>
<div id="infinity"></div>
<style contenteditable> 
#infinity {
    position: relative;
    width: 212px;
    height: 100px;
}
#infinity:before,
#infinity:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 60px;    
    border: 20px solid #f66;
    -moz-border-radius: 50px 50px 0 50px;
         border-radius: 50px 50px 0 50px;
    -webkit-transform: rotate(-45deg);
       -moz-transform: rotate(-45deg);
        -ms-transform: rotate(-45deg);
         -o-transform: rotate(-45deg);
            transform: rotate(-45deg);
}
#infinity:after {
    left: auto;
    right: 0;
    -moz-border-radius: 50px 50px 50px 0;
         border-radius: 50px 50px 50px 0;
    -webkit-transform: rotate(45deg);
       -moz-transform: rotate(45deg);
        -ms-transform: rotate(45deg);
         -o-transform: rotate(45deg);
            transform: rotate(45deg);
}</style>
</p>
</div>
<div class="shape">
<h5>菱形</h5>
<div id="diamond"></div>
<style scoped contenteditable> 
#diamond {
   width: 80px; 
   height: 80px; 
   background: #f66;
   margin: 50px 20px 20px 60px;
   -webkit-transform: rotate(-45deg);
   -moz-transform:    rotate(-45deg);
   -ms-transform:     rotate(-45deg);
   -o-transform: rotate(-45deg);
   transform: rotate(-45deg);
   -webkit-transform-origin: 0 100%;
   -moz-transform-origin: 0 100%;
   -ms-transform-origin: 0 100%;
   -o-transform-origin: 0 100%;
   transform-origin: 0 100%;
}</style>
</p>
</div>
<div class="shape">
<h5>鸡蛋</h5>
<div id="egg"></div>
<style scoped contenteditable> 
#egg {
   display:block;
   width: 126px; 
   height: 180px;
   background-color: #f66;
   -webkit-border-radius: 63px 63px 63px 63px / 108px 108px 72px 72px;
   border-radius:        50%   50%  50%  50%  / 60%   60%   40%  40%;
}</style>
</p>
</div>
<div class="shape">
<h5>吃豆人</h5>
<div id="pacman"></div>
<style scoped contenteditable> 
#pacman {
  width: 0px;
  height: 0px;
  border-right: 60px solid transparent;
  border-top: 60px solid #f66;
  border-left: 60px solid #f66;
  border-bottom: 60px solid #f66;
  border-top-left-radius: 60px;
  border-top-right-radius: 60px;
  border-bottom-left-radius: 60px;
  border-bottom-right-radius: 60px;
}</style>
</p>
</div>
<div class="shape">
<h5>说话泡泡</h5>
<div id="talkbubble"></div>
<style scoped contenteditable> 
#talkbubble {
   width: 120px; 
   height: 80px; 
   background: #f66;
   position: relative;
   -moz-border-radius:    10px; 
   -webkit-border-radius: 10px; 
   border-radius:         10px;
}
#talkbubble:before {
   content:"";
   position: absolute;
   right: 100%;
   top: 26px;
   width: 0;
   height: 0;
   border-top: 13px solid transparent;
   border-right: 26px solid #f66;
   border-bottom: 13px solid transparent;
}</style>
</p>
</div>
<div class="shape">
<h5>12星形 <a href="http://commondream.net/post/8848553728/pure-css-badges">via Alan Johnson</a></h5>
<div id="burst-12"></div>
<style scoped contenteditable> 
#burst-12 {
    background: #f66;
    width: 80px;
    height: 80px;
    position: relative;
    text-align: center;
}
#burst-12:before, #burst-12:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 80px;
    width: 80px;
    background: #f66;
}
#burst-12:before {
    -webkit-transform: rotate(30deg);
       -moz-transform: rotate(30deg);
        -ms-transform: rotate(30deg);
         -o-transform: rotate(30deg);
            transform: rotate(30deg);
}
#burst-12:after {
    -webkit-transform: rotate(60deg);
       -moz-transform: rotate(60deg);
        -ms-transform: rotate(60deg);
         -o-transform: rotate(60deg);
            transform: rotate(60deg);
}</style>
</p>
</div>
<div class="shape">
<h5>8星形 <a href="http://commondream.net/post/8848553728/pure-css-badges">via Alan Johnson</a></h5>
<div id="burst-8"></div>
<style scoped contenteditable> 
#burst-8 {
    background: #f66;
    width: 80px;
    height: 80px;
    position: relative;
    text-align: center;
    -webkit-transform: rotate(20deg);
       -moz-transform: rotate(20deg);
        -ms-transform: rotate(20deg);
         -o-transform: rotate(20eg);
            transform: rotate(20deg);
}
#burst-8:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 80px;
    width: 80px;
    background: #f66;
    -webkit-transform: rotate(135deg);
       -moz-transform: rotate(135deg);
        -ms-transform: rotate(135deg);
         -o-transform: rotate(135deg);
            transform: rotate(135deg);
}</style>
</div>
<p>(全文完)</p>
<p><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/6913.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/10.jpg" alt="神奇的CSS形状 " width="150" height="150" /></a><a href="https://coolshell.cn/articles/6913.html" class="wp_rp_title">神奇的CSS形状 </a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/30.jpg" alt="Web开发中需要了解的东西" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_title">Web开发中需要了解的东西</a></li><li ><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/14.jpg" alt="一些有意思的贴子和工具" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_title">一些有意思的贴子和工具</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/5164.html">CSS图形</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/5164.html/feed</wfw:commentRss>
			<slash:comments>48</slash:comments>
		
		
			</item>
		<item>
		<title>一些有意思的贴子和工具</title>
		<link>https://coolshell.cn/articles/3903.html</link>
					<comments>https://coolshell.cn/articles/3903.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Fri, 04 Mar 2011 00:25:39 +0000</pubDate>
				<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[Algorithm]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[ebook]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=3903</guid>

					<description><![CDATA[<p>又到了介绍各种杂项的时候了，正如以前的这三篇（这篇，这篇，和这篇）文章一样，本篇文章也给你介绍一些最近出现的一些有趣的东西。希望你能喜欢。 先说找工作吧，电影《...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/3903.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/3903.html">一些有意思的贴子和工具</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>又到了介绍各种杂项的时候了，正如以前的这三篇（<a title="一些非常有意思的杂项资源" href="https://coolshell.cn/articles/3013.html" target="_blank">这篇</a>，<a title="一些杂项资源" href="https://coolshell.cn/articles/3437.html" target="_blank">这篇</a>，和<a title="一些有意思的网站和贴子" href="https://coolshell.cn/articles/3480.html" target="_blank">这篇</a>）文章一样，本篇文章也给你介绍一些最近出现的一些有趣的东西。希望你能喜欢。</p>
<p>先说找工作吧，电影《<a title="社交网络（豆瓣）" href="http://movie.douban.com/subject/3205624/" target="_blank">该页无法显示</a>》里的那个<a href="http://www.facebook.com" target="_blank">facebook</a>主页上的<strong><a title="FaceBook的招聘题" href="http://www.facebook.com/careers/puzzles.php" target="_blank">招聘网页</a></strong>上是列了一堆问题，你可以去看看，你可以使用c/c++，Erlang，Haskell，Java，Perl，Python，PHP，Ruby来解题，不过只接受Unix/Linux下的版本， 不接受Windows的版本。无独有偶，<a href="http://www.dropbox.com/" target="_blank">DropBox</a>的<strong><a title="DropBox的招聘题 " href="http://www.dropbox.com/jobs/challenges" target="_blank">招聘网页</a></strong>上也是些算法题，大家可以过去看看，不过需要翻墙。（现在，对于美国互联网企业来说，如果你没有被<a title="中国的C2C模式" href="https://coolshell.cn/articles/3820.html" target="_blank">C2C</a>，说明你根本不存在，如果你没有被墙，说明你还不算成功）</p>
<p>接下来给大家介绍一些文档和教程吧，都是英文的。</p>
<ul>
<li><strong><a href="http://www.harding.edu/fmccown/java_csharp_comparison.html" target="_blank">Java和C#的完整比较</a></strong>。这是一个相当完整的比较Java和C#语言的网页。很有意思，有助于你了解Java和C#的各种特性和不同。</li>
</ul>
<ul>
<li><strong><a href="http://use-the-index-luke.com/" target="_blank">SQL 性能调优</a></strong>。这个文档覆盖了<em>IBM DB2</em>, <em>MySQL</em>, <em>Oracle</em>,<em>PostgreSQL</em> 和 <em>Microsoft SQL Server</em>。不过这个电子书还没有写完，你可以使用其<a href="http://use-the-index-luke.com/blog/feed" target="_blank">RSS</a>, <a href="http://twitter.com/MarkusWinand">twitter</a> 或 <a title="Like on Facebook" href="http://www.facebook.com/plugins/like.php?href=http://www.facebook.com/pages/Use-The-Index-Luke/157726730906717?ref%3Dts&amp;layout=standard&amp;show_faces=true&amp;width=250&amp;action=like&amp;colorscheme=light&amp;height=80">Facebook</a> 来跟踪其进度。</li>
</ul>
<ul>
<li><strong><a href="http://www.cleveralgorithms.com/" target="_blank">Clever Algorithms</a></strong>。这个电子书也是免费的。其主要面向一些AI和面向自然的算法，一共45个。其包括概率随机算法，迭代进化算法，物理算法，可能性算法，蚂蚁蜜蜂式算法，免疫算法，神经算法等。里面大量的高等数学公式对我来说我已经看不懂了。不过，我相信这个电子书非常适合搞理论研究的人，或是需要抄袭一篇论文以顺利毕业的人使用。</li>
</ul>
<ul>
<li><strong><a href="http://blog.gingertech.net/wp-content/uploads/2011/01/LCA_MM_AVProc2011/#slide1" target="_blank">HTML5 Audio &amp; Video 处理</a></strong>。这是一组在线的幻灯片，请使用键盘光标键翻页。这是一组带着各种演示的幻灯片，对于你要学习HTML5的声音和视频相关的知识很有帮助。</li>
</ul>
<ul>
<li><strong><a href="http://www.mikeash.com/pyblog/friday-qa-2010-12-31-c-macro-tips-and-tricks.html" target="_blank">C 语言的宏</a></strong>。你想知道C语的宏有哪些有些意思的用法吗？这篇文档不会让你失望的。其由浅入深地向你介绍了宏的各种用法。</li>
</ul>
<ul>
<li><strong><a href="http://stringoftheseus.com/blog/2011/01/10/api-sorting-algorithms/" target="_blank">各种语言的排序算法</a></strong>。你想知道各种语言其默认的排序算法用的是<a title="一个排序算法比较的网站" href="https://coolshell.cn/articles/399.html" target="_blank">哪种排序算法</a>吗？看看这篇文章吧。</li>
</ul>
<ul>
<li><strong><a href="http://fixplz.blourp.com/blog/=phys" target="_blank">物理模拟F#教程</a></strong>。相信你一定玩过那种游戏，画一个任意形状的石头，其会从天上落下以砸下面的一个东西，这个教程用.NET的F#向大家说明了这种东西怎么去做。（<a href="http://fixplz.blourp.com/blog/img/fsphys.rar" target="_blank">演示程序</a>）</li>
</ul>
<p><span id="more-3903"></span></p>
<ul>
<li><strong><a href="http://www.helixsoft.nl/articles/circle/sincos.htm" target="_blank">Sin &amp; Cos游戏教程</a></strong>。这篇文章向你介绍了一些游戏编程的技术。</li>
</ul>
<ul>
<li><strong><a href="http://damienradtke.org/unofficial-introduction-to-gnome-application-dev/" target="_blank">GNOME开发介绍</a></strong>。这是一个非官方的介绍GNOME应用开发的教程，简单清楚，很适合初学者。</li>
</ul>
<ul>
<li><strong><a href="http://www.korokithakis.net/tutorials/python" target="_blank">10分钟学会Python</a></strong>。是的，也许你和我一样，很恨这样几天就学好一门语言的书，比如：<a title="“21天教你学会C++”" href="https://coolshell.cn/articles/2250.html" target="_blank">21天学好C++</a>。这个更夸张，10分钟。TNND。不过，当我看了一下后，我觉得其很适合初学者对Python有一个感性的认识。</li>
</ul>
<ul>
<li><strong><a href="http://nicolasgallagher.com/css-drop-shadows-without-images/" target="_blank">CSS阴影教程</a></strong>。这是一篇教你种CSS做出种式样式的阴影效果的教程，这里是<a href="http://nicolasgallagher.com/css-drop-shadows-without-images/demo/" target="_blank">演示</a>。</li>
</ul>
<ul>
<li><strong><a href="http://gergo.erdi.hu/blog/2011-02-13-developing_iphone_applications_in_haskell___a_tutorial/" target="_blank">用Haskell开发iPhone应用</a></strong>。这是一个教程序，告诉你如何用Haskell开发iOS的应用程序。</li>
</ul>
<p>下面，再让我给你介绍一些和Web开发相关的开源的库。</p>
<ul>
<li><strong><a href="http://www.photon-project.com/" target="_blank">Photon</a></strong>。这是一个号称高性能的轻量级的PHP应用服务器框架。号称比Zend，Symfony和mod_php快3-10倍。</li>
</ul>
<ul>
<li><strong><a href="http://web.chemdoodle.com/" target="_blank">ChemDoodle</a></strong>。这是一个用来画一些化学分子式的基于HTML5的类库和API，支持2D/3D，很强大。兼容于所有产商的支持HTML5的浏览器。</li>
</ul>
<ul>
<li><strong><a href="http://www.limejs.com/" target="_blank">LimeJS</a></strong>。这个JS库可以让你方便得制作一些触摸屏的小游戏。<a href="http://www.limejs.com/static/roundball/index.html" target="_blank">演示一</a>，<a href="http://www.limejs.com/static/zlizer/index.html" target="_blank">演示二</a>。（<a title="JS游戏引擎列表" href="https://coolshell.cn/articles/3516.html" target="_blank">一些游戏相关的JS</a>）</li>
</ul>
<ul>
<li><strong><a href="https://github.com/ruidlopes/spellcheckthejs" target="_blank">拼写检查</a></strong>。这是一个英文拼写检查的JS。</li>
</ul>
<ul>
<li><strong><a href="http://www.clips.ua.ac.be/pages/pattern" target="_blank">Pattern</a></strong>。这是东东很强大，用于做Web挖掘，其有一组工具用来从Google, Twitter, Wikipedia，Web爬虫，HTML上获得数据，并进行文本分析和数据图形化显示。你可以上这里看看<a href="http://www.clips.ua.ac.be/demos" target="_blank">相关演示</a>。</li>
</ul>
<ul>
<li><strong><a href="http://www.appcelerator.com/products/titanium-mobile-application-development/">Titanium Mobile</a></strong>。你想让你的代码同时支持iPhone和Android吗？这是一个跨平台的开发工具。这里有<a href="http://agiliq.com/blog/2011/02/iphoneandroid-application-development-using-titani/" target="_blank">一个教程</a>。</li>
</ul>
<ul>
<li><strong><a href="http://css3buttons.michaelhenriksen.dk/" target="_blank">CSS3的按钮</a></strong>。这里可以去下载一个CSS3的库，里面有N多的按钮风格，感觉都很酷。</li>
</ul>
<p>接下来，介绍一些小工具。</p>
<ul>
<li><strong><a href="http://caniuse.com/" target="_blank">Web兼容性表</a></strong>。你想看看各种浏览器对HTML5，CSS3，SVG的支持吗？这个网站可以让你看到所有的主流浏览器的兼容表。</li>
</ul>
<ul>
<li><strong><a href="http://www.qgrep.com/" target="_blank">qgrep</a></strong>。嫌grep不够快吗？试试qgrep吧，支持OSX,  Linux 和 Windows。</li>
</ul>
<ul>
<li><strong><a href="http://www.cam.hi-ho.ne.jp/oishi/indexen.html" target="_blank">XKeymacs</a></strong>。你有Emacs情结吗？如果有的话，试试这个工具吧，在windows里到处c-x c-c, c-x c-s, c-p, c-n什么什么的。挺有意思的。好吧，不是有意思，是BT。</li>
</ul>
<ul>
<li><strong><a href="http://www.sublimetext.com/blog/articles/sublime-text-2-public-alpha" target="_blank">Sublime Text 2</a></strong>。虽然目前只是Alpha版本，但是这个看上去真的很不错。尤其是用来查看代码。支持Windows, Linux和OSX。</li>
</ul>
<ul>
<li><strong><a href="http://code.google.com/p/vs-android/" target="_blank">VS-Android</a></strong>。这个项目让你可以在Visual Studio 2010的IDE下开发Android NDK C/C++的程序。</li>
</ul>
<p>其它东西。</p>
<ul>
<li><strong><a href="http://rigaux.org/language-study/scripting-language/" target="_blank">脚本语言排名</a></strong>。这个网页不但对所有的脚本语言进行了排名，还对一些操作进行了比较。</li>
</ul>
<ul>
<li>HTML5的3D演示，这里有几个HTML5的3D演示，你可以看看，<a title="sketch/" href="http://hakim.se/experiments/html5/sketch/#1966de71" target="_blank">演示一</a>，<a title="蛋白质分子式" href="http://jolecule.appspot.com/pdb/1mbo#view:4mfct8" target="_blank">演示二</a>，<a title="立方体" href="http://dl.dropbox.com/u/59304/labs/cubeStable.html" target="_blank">演示三</a>，<a title="坦克游戏" href="http://dl.dropbox.com/u/59304/labs/tankGame.html" target="_blank">演示四</a>。</li>
</ul>
<ul>
<li>说到Web上的3D，你可能需要看看Adobe的<a title="Molehill APIs" href="http://labs.adobe.com/technologies/flashplatformruntimes/incubator/features/molehill.html" target="_blank">Molehill (3D GPU accelerated) APIs</a>，这里有一篇<a href="http://www.bytearray.org/?p=2810" target="_blank">介绍文章</a>。</li>
</ul>
<ul>
<li>还记得那个<a title="流体力学的演示" href="https://coolshell.cn/articles/3421.html" target="_blank">流体力学的演示</a>吗？现在有人把其做到了<a href="http://www.infi.nl/blog/view/id/98/Liquid_on_iPhone_and_iPad" target="_blank">iPhone/iPad上</a>。</li>
</ul>
<p>就这么多吧，也许没什么意思，那也请你见谅了。</p>
<p>（全文完）<!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/3013.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2010/09/biolab-150x150.jpg" alt="一些非常有意思的杂项资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3013.html" class="wp_rp_title">一些非常有意思的杂项资源</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/5537.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/11/stackparts.com_-150x150.png" alt="一些文章资源和趣闻" width="150" height="150" /></a><a href="https://coolshell.cn/articles/5537.html" class="wp_rp_title">一些文章资源和趣闻</a></li><li ><a href="https://coolshell.cn/articles/4795.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/7.jpg" alt="开源中最好的Web开发的资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/4795.html" class="wp_rp_title">开源中最好的Web开发的资源</a></li><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/3903.html">一些有意思的贴子和工具</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/3903.html/feed</wfw:commentRss>
			<slash:comments>24</slash:comments>
		
		
			</item>
		<item>
		<title>Web开发人员速查卡</title>
		<link>https://coolshell.cn/articles/3684.html</link>
					<comments>https://coolshell.cn/articles/3684.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Wed, 16 Feb 2011 10:59:06 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[Cheat Sheet]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Unicode]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[XML]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=3684</guid>

					<description><![CDATA[<p>无论你是多牛的程序员，你都无法记住所有的东西。而很多时候，查找某些知识又比较费事。所以，网上有很多Cheat Sheets，翻译成小抄也好 ，速查卡也好，总之就...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/3684.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/3684.html">Web开发人员速查卡</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>无论你是多牛的程序员，你都无法记住所有的东西。而很多时候，查找某些知识又比较费事。所以，网上有很多Cheat Sheets，翻译成小抄也好 ，速查卡也好，总之就是帮你节省 时间的。之前给大家介绍过<a rel="bookmark" href="https://coolshell.cn/articles/870.html" target="_blank">Web设计的速查卡</a>、<a rel="bookmark" href="https://coolshell.cn/articles/2964.html" target="_blank">25个jQuery的编程小抄</a>，还有<a rel="bookmark" href="https://coolshell.cn/articles/1566.html" target="_blank">程序员小抄大全</a>，今天转一篇开发人员的速查卡，<a href="http://www.topdesignmag.com/all-the-cheat-sheets-that-a-web-developer-needs/" target="_blank">源文在这里</a>。下面的文章我就不翻译了。</p>
<h2>HTML Cheat Sheet</h2>
<p><img decoding="async" loading="lazy" title="1" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/1128.jpg" alt="" width="450" height="127" /></p>
<ul>
<li><a href="http://www.html.su/" target="_blank">HTML/XTML in one page</a></li>
<li><a href="http://refcardz.dzone.com/refcardz/html5-new-standards-web-interactivity" target="_blank">HTML5: The Evolution of Web Standards by James Sugrue</a></li>
<li><a href="http://www.elizabethcastro.com/html/extras/xhtml_ref.html" target="_blank">(X)HTML Elements and Attributes</a></li>
<li><a href="http://www.w3.org/QA/2002/04/valid-dtd-list.html" target="_blank">Doctype Declarations (DTDs)</a></li>
<li><a href="http://www.digitalmediaminute.com/reference/entity/index.php" target="_blank">XHTML Character Entity Reference</a></li>
<li><a href="http://downloads.gosquared.com/help_sheets/08/HTML-Help-Sheet-02.jpg" target="_blank">GoSquared HTML Help Sheet</a></li>
</ul>
<p><span id="more-3684"></span></p>
<p><strong> </strong></p>
<h2>CSS Cheat Sheets</h2>
<p><img decoding="async" loading="lazy" title="2" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/2104.jpg" alt="" width="451" height="112" /></p>
<ul>
<li><a href="http://www.css.su/" target="_blank">CSS in one page</a></li>
<li><a href="http://www.elizabethcastro.com/html/extras/cssref.html" target="_blank">CSS Properties and Values</a></li>
<li><a href="http://www.blooberry.com/indexdot/css/propindex/all.htm" target="_blank">All CSS Properties Listed Alphabetically</a></li>
<li><a href="http://www.dustindiaz.com/css-shorthand/" target="_blank">CSS Shorthand Guide</a></li>
<li><a href="http://www.gosquared.com/liquidicity/archives/1010" target="_blank">GoSquared CSS Help Sheet</a></li>
</ul>
<h2>Adobe Flash Cheat Sheets</h2>
<p><img decoding="async" loading="lazy" title="3" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/312.png" alt="" width="449" height="87" /></p>
<ul>
<li><a href="http://michaeldoyle.eu/blog/wp-content/uploads/2009/10/flash-cheat-sheet.pdf" target="_blank">Flash Cheat Sheet</a></li>
<li><a href="http://edutechwiki.unige.ch/en/Flash_CS3_keyboard_shortcuts" target="_blank">Flash CS3 Keyboard Shortcuts</a></li>
</ul>
<p><strong> </strong></p>
<h2><strong>ASP Cheat Sheets</strong></h2>
<h2><strong><img decoding="async" loading="lazy" title="4" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/430.jpg" alt="" width="451" height="106" /><br />
</strong></h2>
<ul>
<li><a href="http://refcardz.dzone.com/refcardz/core-aspnet" target="_blank">Core ASP.NET</a></li>
<li><a href="http://www.newdrp.com/Posters/Development/tabid/67/id/284/Default.aspx" target="_blank">ASP.NET MVC Framework Cheat Sheet</a></li>
<li><a href="http://www.newdrp.com/Posters/Development/tabid/67/id/286/Default.aspx" target="_blank">ASP.NET MVC View Cheat Sheet</a></li>
</ul>
<h2>PHP Cheat Sheets</h2>
<p><img decoding="async" loading="lazy" title="5" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/55.png" alt="" width="450" height="112" /></p>
<ul>
<li><a href="http://www.dreamincode.net/forums/topic/35660-php-quick-reference-cheat-sheet/" target="_blank">PHP Basics Quick Reference Sheet</a></li>
<li><a href="http://www.digilife.be/quickreferences/QRC/PHP%20Cheat%20Sheet.pdf" target="_blank">PHP Cheat Sheet</a></li>
<li><a href="http://www.sk89q.com/content/2010/04/phpsec_cheatsheet.pdf" target="_blank">PHP Security Cheat Sheet</a></li>
<li><a title="PHP Variable and Array Tests (php version 5.1.6) by Barry Hunter" href="http://www.deformedweb.co.uk/php_variable_tests.php" target="_blank">PHP Variable and Array Tests</a></li>
<li><a href="http://downloads.gosquared.com/help_sheets/08/PHP-Help-Sheet-01.jpg" target="_blank">GoSquared PHP Help Sheet</a></li>
</ul>
<h2>MySQL Cheat Sheets</h2>
<p><img decoding="async" loading="lazy" title="6" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/65.png" alt="" width="450" height="89" /></p>
<ul>
<li><a href="http://www.addedbytes.com/cheat-sheets/mysql-cheat-sheet/" target="_blank">MySQL Cheat Sheet by Dave Child</a></li>
<li><a href="http://www.cheat-sheets.org/saved-copy/MySQL_QuickRef.pdf" target="_blank">MySQL Database Quick Reference</a></li>
<li><a href="http://www.sqltutorial.org/sql-cheat-sheet.aspx" target="_blank">SQL Statements Cheat Sheet</a></li>
</ul>
<h2>JavaScript Cheat Sheets</h2>
<p><img decoding="async" loading="lazy" title="7" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/75.png" alt="" width="451" height="118" /></p>
<ul>
<li><a href="http://www.javascript.su/" target="_blank">JavaScript in one page</a></li>
<li><a href="http://www.addedbytes.com/cheat-sheets/javascript-cheat-sheet/" target="_blank">JavaScript Cheat Sheet</a></li>
<li><a href="http://wps.aw.com/wps/media/objects/2234/2287950/javascript_refererence.pdf" target="_blank">Addison-Wesley’s JavaScript Reference Card</a></li>
</ul>
<h2>jQuery Cheat Sheets</h2>
<p><img decoding="async" loading="lazy" title="8" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/85.png" alt="" width="450" height="109" /></p>
<ul>
<li><a href="http://colorcharge.com/jquery/" target="_blank">jQuery Cheatsheet</a></li>
<li><a href="http://woork.blogspot.com/2009/09/jquery-visual-cheat-sheet.html" target="_blank">jQuery 1.3 Visual Cheat Sheet by Antonio Lupetti</a></li>
<li><a href="http://refcardz.dzone.com/refcardz/jquery-selectors" target="_blank">jQuery Selectors by Bear Bibeault &amp; Yehuda Katz</a></li>
</ul>
<h2>Unicode Cheat Sheets</h2>
<p><img decoding="async" loading="lazy" title="9" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/97.png" alt="" width="450" height="112" /></p>
<ul>
<li><a href="http://www.utf.ru/" target="_blank">The Unicode Character Code</a></li>
<li><a href="http://www.visibone.com/htmlref/char/cer.htm" target="_blank">HTML Characters, Numeric Codes, 0-65535 by Bob Stein</a></li>
</ul>
<h2>XML Cheat Sheets</h2>
<p><img decoding="async" loading="lazy" title="10" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/106.png" alt="" width="450" height="111" /></p>
<ul>
<li><a href="http://www.xml.su/" target="_blank">XML in one page</a></li>
<li><a href="http://www.mulberrytech.com/quickref/XMLquickref.pdf" target="_blank">XML 1.0 Syntax Quick Reference by Mulberry Technologies</a></li>
</ul>
<h2>mod_rewrite and .htaccess Cheat Sheets</h2>
<p><img decoding="async" loading="lazy" title="11" src="http://www.topdesignmag.com/wp-content/uploads/2011/01/1111.png" alt="" width="455" height="95" /></p>
<ul>
<li><a href="http://www.addedbytes.com/cheat-sheets/mod_rewrite-cheat-sheet/" target="_blank">mod_rewrite Cheat Sheet by Dave Child</a></li>
<li><a href="http://www.thejackol.com/htaccess-cheatsheet/" target="_blank">htaccess Cheatsheet</a></li>
</ul>
<p>（全文完）<!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/4795.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/7.jpg" alt="开源中最好的Web开发的资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/4795.html" class="wp_rp_title">开源中最好的Web开发的资源</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/3013.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2010/09/biolab-150x150.jpg" alt="一些非常有意思的杂项资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3013.html" class="wp_rp_title">一些非常有意思的杂项资源</a></li><li ><a href="https://coolshell.cn/articles/1949.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/16.jpg" alt="Web中的省略号" width="150" height="150" /></a><a href="https://coolshell.cn/articles/1949.html" class="wp_rp_title">Web中的省略号</a></li><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/3684.html">Web开发人员速查卡</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/3684.html/feed</wfw:commentRss>
			<slash:comments>22</slash:comments>
		
		
			</item>
		<item>
		<title>30+ Web下拉菜单</title>
		<link>https://coolshell.cn/articles/3207.html</link>
					<comments>https://coolshell.cn/articles/3207.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Wed, 20 Oct 2010 06:06:43 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Menu]]></category>
		<category><![CDATA[UI]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=3207</guid>

					<description><![CDATA[<p>以前给大家介绍过13个不错的Javascript和CSS的菜单、20个优秀的Javascript导航技术、30种时尚的CSS网站导航条，今天在网上看到一篇文章其...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/3207.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/3207.html">30+ Web下拉菜单</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>以前给大家介绍过<a rel="bookmark" href="https://coolshell.cn/articles/1660.html" target="_blank">13个不错的Javascript和CSS的菜单</a>、<a rel="bookmark" href="https://coolshell.cn/articles/918.html" target="_blank">20个优秀的Javascript导航技术</a>、<a rel="bookmark" href="https://coolshell.cn/articles/562.html" target="_blank">30种时尚的CSS网站导航条</a>，今天在网上看到一篇文章其收集了30多个下拉菜单（分为两类，jQuery和CSS+Javascript的），转过来。</p>
<p>原文：<a href="http://smashinghub.com/3-useful-drop-down-menu-scripts-to-enhance-header-navigation.htm" target="_blank">http://smashinghub.com/3-useful-drop-down-menu-scripts-to-enhance-header-navigation.htm</a></p>
<h4>jQuery</h4>
<h3><strong><a href="http://www.dynamicdrive.com/dynamicindex1/ddsmoothmenu.htm"><strong>Smooth Navigation Menu</strong></a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-5.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4179" title="Drop-Down-Menu-Scripts-5" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-5.jpg" alt="Drop Down Menu Scripts 5 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /><br />
</a></strong></p>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-5.jpg"></a></strong></p>
<p><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-5.jpg"></a></p>
<p><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-5.jpg"> </a></p>
<p><span id="more-3207"></span></p>
<p><strong><br />
</strong></p>
<h3><strong> </strong><strong><a href="http://javascript-array.com/scripts/jquery_simple_drop_down_menu/">Simple Drop Down Menu Plugin</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-6.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4178" title="Drop-Down-Menu-Scripts-6" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-6.jpg" alt="Drop Down Menu Scripts 6 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong><a href="http://www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/">Dropdown, iPod Drilldown, and Flyout styles </a></strong></h3>
<div><strong><br />
</strong></div>
<div><a href="http://smashinghub.com/wp-content/uploads/2010/10/drilldown.gif"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4185" title="drilldown" src="http://smashinghub.com/wp-content/uploads/2010/10/drilldown.gif" alt="drilldown 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="360" /></a></div>
<h3><strong><a href="http://designreviver.com/tutorials/jquery-css-example-dropdown-menu/">jQuery and CSS Example</a><br />
</strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-7.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4177" title="Drop-Down-Menu-Scripts-7" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-7.jpg" alt="Drop Down Menu Scripts 7 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong> </strong><strong><a href="http://www.webdesigndev.com/web-development/create-the-fanciest-dropdown-menu-you-ever-saw">Create the Fanciest Drop Down Menu You Ever Saw</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-8.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4176" title="Drop-Down-Menu-Scripts-8" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-8.jpg" alt="Drop Down Menu Scripts 8 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong><a href="http://net.tutsplus.com/tutorials/javascript-ajax/a-different-top-navigation/">A Different Top Navigation</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-9.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4174" title="Drop-Down-Menu-Scripts-9" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-9.jpg" alt="Drop Down Menu Scripts 9 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong> </strong><strong><a href="http://css-tricks.com/simple-jquery-dropdowns/">Simple jQuery Dropdowns</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-15.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4169" title="Drop-Down-Menu-Scripts-15" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-15.jpg" alt="Drop Down Menu Scripts 15 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong><a href="http://www.noupe.com/tutorial/drop-down-menu-jquery-css.html"><strong>Sexy Drop Down Menu with jQuery and CSS</strong></a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-1.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4183" title="Drop-Down-Menu-Scripts-1" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-1.jpg" alt="Drop Down Menu Scripts 1 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong><a href="http://net.tutsplus.com/tutorials/html-css-techniques/how-to-create-a-drop-down-nav-menu-with-html5-css3-and-jquery/"><strong>How to Create a Drop Down Nav Menu with HTML5, CSS3, and jQuery</strong></a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-31.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4182" title="Drop-Down-Menu-Scripts-3" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-31.jpg" alt="Drop Down Menu Scripts 31 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong><a href="http://www.jankoatwarpspeed.com/post/2009/07/28/reinventing-drop-down-with-css-jquery.aspx">Reinventing a Drop Down with CSS and jQuery</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-14.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4168" title="Drop-Down-Menu-Scripts-14" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-14.jpg" alt="Drop Down Menu Scripts 14 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong> </strong><strong><a href="http://users.tpg.com.au/j_birch/plugins/superfish/">Superfish</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-13.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4170" title="Drop-Down-Menu-Scripts-13" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-13.jpg" alt="Drop Down Menu Scripts 13 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a></strong><strong> </strong><strong><a href="http://www.clarklab.net/blog/posts/animated-drop-down-menu-with-jquery/"></a></strong></p>
<h3><strong><a href="http://www.clarklab.net/blog/posts/animated-drop-down-menu-with-jquery/">Animated Drop Down Menu with jQuery</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-12.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4171" title="Drop-Down-Menu-Scripts-12" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-12.jpg" alt="Drop Down Menu Scripts 12 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong><a href="http://www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/">jQuery Menu: Dropdown, Drilldown, and iPod Flyout Styles</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-16.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4167" title="Drop-Down-Menu-Scripts-16" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-16.jpg" alt="Drop Down Menu Scripts 16 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong><a href="http://www.givainc.com/labs/mcdropdown_jquery_plugin.htm">McDropdown jQuery Plugin</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-17.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4166" title="Drop-Down-Menu-Scripts-17" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-17.jpg" alt="Drop Down Menu Scripts 17 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a></strong><strong><a href="http://www.hv-designs.co.uk/2009/02/17/sliding-jquery-menu/"><strong> </strong></a></strong></p>
<h3><strong><a href="http://www.sohtanaka.com/web-design/mega-drop-downs-w-css-jquery/"><strong>Mega Drop Down Menus with CSS &amp; jQuery</strong></a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-3.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4181" title="Drop-Down-Menu-Scripts-3" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-3.jpg" alt="Drop Down Menu Scripts 3 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong><a href="http://www.hv-designs.co.uk/2009/02/17/sliding-jquery-menu/"><strong>Sliding jQuery Menu</strong></a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-4.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4180" title="Drop-Down-Menu-Scripts-4" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-4.jpg" alt="Drop Down Menu Scripts 4 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong><a href="http://jdsharp.us/jQuery/plugins/jdMenu/">jdMenu Hierarchical Menu Plugin</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-18.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4164" title="Drop-Down-Menu-Scripts-18" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-18.jpg" alt="Drop Down Menu Scripts 18 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong> </strong><strong><a href="http://apycom.com/menus/1-dim-gray.html">Dim Gray Drop Down Menu</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-19.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4163" title="Drop-Down-Menu-Scripts-19" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-19.jpg" alt="Drop Down Menu Scripts 19 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></p>
<h3><strong><a href="http://www.kriesi.at/archives/create-a-multilevel-dropdown-menu-with-css-and-improve-it-via-jquery">Create a MultiLevel Dropdown Menu with CSS and Improve it with jQuery</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-20.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4162" title="Drop-Down-Menu-Scripts-20" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-20.jpg" alt="Drop Down Menu Scripts 20 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a></strong></p>
<h3><strong> </strong><strong><a href="http://www.queness.com/post/966/jquery-drop-down-menu-for-rss-subscription-tutorial">jQuery Drop Down Menu for RSS Subscription</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-11.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4172" title="Drop-Down-Menu-Scripts-11" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-11.jpg" alt="Drop Down Menu Scripts 11 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a></strong><strong> </strong><strong><a href="http://www.queness.com/preview/1047/easy-to-style-jquery-drop-down-menu-tutorial"></a></strong></p>
<h3><strong><a href="http://www.queness.com/preview/1047/easy-to-style-jquery-drop-down-menu-tutorial">Easy to Style jQuery Drop Down Menu</a></strong></h3>
<h2><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-10.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4173" title="Drop-Down-Menu-Scripts-10" src="http://smashinghub.com/wp-content/uploads/2010/10/Drop-Down-Menu-Scripts-10.jpg" alt="Drop Down Menu Scripts 10 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="300" /></a><br />
</strong></h2>
<h4><strong>CSS and Java Scripts<br />
</strong></h4>
<h3><strong><a rel="nofollow" href="http://lwis.net/free-css-drop-down-menu/">Lwis Dropdown Menu Framework</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/lwis_menu.png"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4187" title="lwis_menu" src="http://smashinghub.com/wp-content/uploads/2010/10/lwis_menu.png" alt="lwis menu 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="236" /></a></strong></p>
<h3><strong><a rel="nofollow" href="http://greengeckodesign.com/projects/menumatic.aspx">MenuMatic </a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/menumatic.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4188" title="menumatic" src="http://smashinghub.com/wp-content/uploads/2010/10/menumatic.jpg" alt="menumatic 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="236" /></a></strong><strong><a rel="nofollow" href="http://www.andrewsellick.com/35/sexy-sliding-javascript-side-bar-menu-using-mootools"></a></strong></p>
<h3><strong><a rel="nofollow" href="http://www.andrewsellick.com/35/sexy-sliding-javascript-side-bar-menu-using-mootools">Sexy Sliding Menu</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/sliding_menu.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4189" title="sliding_menu" src="http://smashinghub.com/wp-content/uploads/2010/10/sliding_menu.jpg" alt="sliding menu 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="236" /></a></strong></p>
<h3><strong><a rel="nofollow" href="http://www.cssplay.co.uk/menus/circular-sub.html">Circular Menu</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/circular_menu.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4190" title="circular_menu" src="http://smashinghub.com/wp-content/uploads/2010/10/circular_menu.jpg" alt="circular menu 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="236" /></a></strong><strong><a rel="nofollow" href="http://www.jankoatwarpspeed.com/post/2009/01/19/Create-Vimeo-like-top-navigation.aspx"></a></strong></p>
<h3><strong><a rel="nofollow" href="http://www.jankoatwarpspeed.com/post/2009/01/19/Create-Vimeo-like-top-navigation.aspx">Vimeo-like Top Navigation</a></strong></h3>
<p><a href="http://smashinghub.com/wp-content/uploads/2010/10/vimeo_menu.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4191" title="vimeo_menu" src="http://smashinghub.com/wp-content/uploads/2010/10/vimeo_menu.jpg" alt="vimeo menu 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="236" /></a><strong><a rel="nofollow" href="http://www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/"></a></strong></p>
<h3><strong><a rel="nofollow" href="http://www.filamentgroup.com/lab/jquery_ipod_style_and_flyout_menus/">FG jQuery Menu</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/fg_menu.png"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4192" title="fg_menu" src="http://smashinghub.com/wp-content/uploads/2010/10/fg_menu.png" alt="fg menu 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="236" /></a></strong></p>
<h3><strong><a rel="nofollow" href="http://extjs.com/">Ext JS Tree Panel</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/dragdrop.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4193" title="dragdrop" src="http://smashinghub.com/wp-content/uploads/2010/10/dragdrop.jpg" alt="dragdrop 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="236" /></a></strong></p>
<h3><strong><a rel="nofollow" href="http://www.kriesi.at/archives/apple-menu-improved-with-jquery">Apple Style Menu</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/appele1.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4194" title="appele1" src="http://smashinghub.com/wp-content/uploads/2010/10/appele1.jpg" alt="appele1 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="236" /></a></strong></p>
<h3><strong><a rel="nofollow" href="http://www.designmeme.com/articles/hoverboxmenu/">Hover Box</a></strong></h3>
<h3><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/hoverbox.jpg"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4195" title="hoverbox" src="http://smashinghub.com/wp-content/uploads/2010/10/hoverbox.jpg" alt="hoverbox 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="236" /></a></strong><strong><a rel="nofollow" href="http://www.styledmenus.com/">Styled Menus</a></strong></h3>
<p><strong><a href="http://smashinghub.com/wp-content/uploads/2010/10/style.png"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-4196" title="style" src="http://smashinghub.com/wp-content/uploads/2010/10/style.png" alt="style 30+ Useful Drop Down Menu Scripts To Enhance Header Navigation" width="500" height="236" /></a></strong></p>
<p>（全文完）<!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/1660.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/15.jpg" alt="13个不错的Javascript和CSS的菜单" width="150" height="150" /></a><a href="https://coolshell.cn/articles/1660.html" class="wp_rp_title">13个不错的Javascript和CSS的菜单</a></li><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/30.jpg" alt="Web开发中需要了解的东西" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_title">Web开发中需要了解的东西</a></li><li ><a href="https://coolshell.cn/articles/4795.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/7.jpg" alt="开源中最好的Web开发的资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/4795.html" class="wp_rp_title">开源中最好的Web开发的资源</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/3207.html">30+ Web下拉菜单</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/3207.html/feed</wfw:commentRss>
			<slash:comments>14</slash:comments>
		
		
			</item>
		<item>
		<title>40个很不错的CSS技术</title>
		<link>https://coolshell.cn/articles/3063.html</link>
					<comments>https://coolshell.cn/articles/3063.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Fri, 08 Oct 2010 00:04:46 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[技术读物]]></category>
		<category><![CDATA[操作系统]]></category>
		<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=3063</guid>

					<description><![CDATA[<p>以前发布过《30种时尚的CSS网站导航条》，下面是40个CSS的技术，可以让你的网页有更好的用户体验。希望你喜欢 1. A CSS styled table v...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/3063.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/3063.html">40个很不错的CSS技术</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>以前发布过《<a title="30种时尚的CSS网站导航条 " href="https://coolshell.cn/articles/562.html" target="_blank">30种时尚的CSS网站导航条</a>》，下面是40个CSS的技术，可以让你的网页有更好的用户体验。希望你喜欢</p>
<h4>1. <a href="http://veerle.duoh.com/blog/comments/a_css_styled_table_version_2/">A CSS styled table version 2</a></h4>
<p><a href="http://veerle.duoh.com/blog/comments/a_css_styled_table_version_2/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5088" title="1css46" src="http://technologytosoftware.com/wp-content/uploads/2010/09/1css46.png" alt="" width="485" height="170" /></a></p>
<h4>2.<a href="http://nidahas.com/2006/12/06/forms-markup-and-css-revisited/"> A CSS-based Form Template</a></h4>
<p><a href="http://nidahas.com/2006/12/06/forms-markup-and-css-revisited/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5089" title="2 css_based_form_template" src="http://technologytosoftware.com/wp-content/uploads/2010/09/2-css_based_form_template.gif" alt="" width="450" height="180" /></a></p>
<p><span id="more-3063"></span></p>
<h4>3. <a href="http://www.wpdfd.com/issues/82/list_style_inspiration/">A Stripe of List Style Inspiration</a></h4>
<p><a href="http://www.wpdfd.com/issues/82/list_style_inspiration/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5090" title="3list-style" src="http://technologytosoftware.com/wp-content/uploads/2010/09/3list-style.png" alt="" width="400" height="204" /></a></p>
<h4>4. <a href="http://www.456bereastreet.com/archive/200705/accessible_expanding_and_collapsing_menu/">Accessible expanding and collapsing menu</a></h4>
<p><a href="http://www.456bereastreet.com/archive/200705/accessible_expanding_and_collapsing_menu/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5091" title="4" src="http://technologytosoftware.com/wp-content/uploads/2010/09/4.gif" alt="" width="416" height="173" /></a></p>
<h4>5. <a href="http://www.3point7designs.com/blog/2007/12/22/advanced-css-menu-trick/">Advanced CSS Menu Trick</a></h4>
<p><a href="http://www.3point7designs.com/blog/2007/12/22/advanced-css-menu-trick/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5092" title="5css" src="http://technologytosoftware.com/wp-content/uploads/2010/09/5css.png" alt="" width="491" height="176" /></a></p>
<h4>6. <a href="http://www.pmob.co.uk/pob/animated.htm">Animated Rollover Arrow</a></h4>
<p><a href="http://www.pmob.co.uk/pob/animated.htm"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5093" title="6animated_roll_over" src="http://technologytosoftware.com/wp-content/uploads/2010/09/6animated_roll_over.jpg" alt="" width="450" height="180" /></a></p>
<h4>7. <a href="http://i.imgur.com/dYFBl.png">Animations</a></h4>
<p><a href="http://i.imgur.com/dYFBl.png"><img decoding="async" loading="lazy" class="aligncenter size-large wp-image-5094" title="7animation" src="http://technologytosoftware.com/wp-content/uploads/2010/09/7animation-580x203.jpg" alt="" width="580" height="203" /></a></p>
<h4>8. <a href="http://i.imgur.com/OcbHO.png">Background Size</a></h4>
<p><a href="http://i.imgur.com/OcbHO.png"><img decoding="async" loading="lazy" class="aligncenter size-large wp-image-5095" title="8bgsize" src="http://technologytosoftware.com/wp-content/uploads/2010/09/8bgsize-580x203.jpg" alt="" width="580" height="203" /></a></p>
<h4>9. <a href="http://css-tricks.com/better-ordered-lists-using-simple-php-and-css/">Better Ordered Lists</a> (Using Simple PHP and CSS)</h4>
<p><a href="http://css-tricks.com/better-ordered-lists-using-simple-php-and-css/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5096" title="9css" src="http://technologytosoftware.com/wp-content/uploads/2010/09/9css.png" alt="" width="485" height="170" /></a></p>
<h4>10. <a href="http://i.imgur.com/e5VlA.png">Box Shadow</a></h4>
<p><a href="http://i.imgur.com/e5VlA.png"><img decoding="async" loading="lazy" class="aligncenter size-large wp-image-5097" title="10shadow" src="http://technologytosoftware.com/wp-content/uploads/2010/09/10shadow-580x203.jpg" alt="" width="580" height="203" /></a></p>
<h4>11. <a href="http://www.askthecssguy.com/2007/08/creating_a_table_with_dynamica.html">Creating a table with dynamically highlighted columns</a></h4>
<p><a href="http://www.askthecssguy.com/2007/08/creating_a_table_with_dynamica.html"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5098" title="11" src="http://technologytosoftware.com/wp-content/uploads/2010/09/11.png" alt="" width="485" height="170" /></a></p>
<h4>12. <a href="http://www.456bereastreet.com/archive/200705/creating_bulletproof_graphic_link_buttons_with_css/">Creating bulletproof graphic link buttons with CSS | 456 Berea Street</a></h4>
<p><a href="http://www.456bereastreet.com/archive/200705/creating_bulletproof_graphic_link_buttons_with_css/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5099" title="12css" src="http://technologytosoftware.com/wp-content/uploads/2010/09/12css.png" alt="" width="485" height="170" /></a></p>
<h4>13. <a href="http://www.cssnewbie.com/12-creative-and-cool-uses-for-the-css-border-property/">Creative and Cool Uses of the CSS Border Property</a></h4>
<p><a href="http://www.cssnewbie.com/12-creative-and-cool-uses-for-the-css-border-property/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5100" title="13CSS-Border-Property" src="http://technologytosoftware.com/wp-content/uploads/2010/09/13CSS-Border-Property.jpg" alt="" width="537" height="189" /></a></p>
<h4>14. <a href="http://www.digital-web.com/articles/web_standards_creativity_png/">Creative Use of PNG Transparency in Web Design</a></h4>
<p><a href="http://www.digital-web.com/articles/web_standards_creativity_png/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5101" title="14css02" src="http://technologytosoftware.com/wp-content/uploads/2010/09/14css02.png" alt="" width="485" height="170" /></a></p>
<h4>15. <a href="http://www.cssplay.co.uk/menu/slide_show">Cross Browser CSS SlideShow</a></h4>
<p><a href="http://www.cssplay.co.uk/menu/slide_show"><img decoding="async" loading="lazy" class="aligncenter size-large wp-image-5102" title="15cross-browser-slide-show" src="http://technologytosoftware.com/wp-content/uploads/2010/09/15cross-browser-slide-show-580x384.jpg" alt="" width="580" height="384" /></a></p>
<h4>16. <a href="http://www.cssplay.co.uk/menu/lightbox.html#Portraits">Cross Browser Multi-Page Photograph Gallery</a></h4>
<p><a href="http://www.cssplay.co.uk/menu/lightbox.html#Portraits"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5103" title="16_cross_browser_image_galler" src="http://technologytosoftware.com/wp-content/uploads/2010/09/16_cross_browser_image_galler.jpg" alt="" width="450" height="180" /></a></p>
<h4>17. <a href="http://applestooranges.com/blog/post/css-for-bar-graphs/?id=55">CSS Bar Graphs: Examples</a></h4>
<p><a href="http://applestooranges.com/blog/post/css-for-bar-graphs/?id=55"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5104" title="17_css_bar_graph_example" src="http://technologytosoftware.com/wp-content/uploads/2010/09/17_css_bar_graph_example.jpg" alt="" width="450" height="180" /></a></p>
<h4>18. <a href="http://www.nundroo.com/navigation/">CSS Based Navigation</a></h4>
<p><a href="http://www.nundroo.com/navigation/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5105" title="18 css-techniques0000" src="http://technologytosoftware.com/wp-content/uploads/2010/09/18-css-techniques0000.gif" alt="" width="485" height="170" /></a></p>
<h4>19. <a href="http://storage.couchfort.net/cssCurves/">CSS Curves</a></h4>
<p><a href="http://storage.couchfort.net/cssCurves/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5106" title="19css-techniques0014" src="http://technologytosoftware.com/wp-content/uploads/2010/09/19css-techniques0014.gif" alt="" width="485" height="170" /></a></p>
<h4>20. <a href="http://www.ndesign-studio.com/blog/mac/css-dock-menu">CSS Dock Menu</a></h4>
<p><a href="http://www.ndesign-studio.com/blog/mac/css-dock-menu"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5107" title="20" src="http://technologytosoftware.com/wp-content/uploads/2010/09/20.png" alt="" width="485" height="170" /></a></p>
<h4>21. <a href="http://mikecherim.com/experiments/css_double_lists.php">CSS Double Lists</a></h4>
<p><a href="http://mikecherim.com/experiments/css_double_lists.php"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5108" title="21css37" src="http://technologytosoftware.com/wp-content/uploads/2010/09/21css37.png" alt="" width="485" height="170" /></a></p>
<h4>22. <a href="http://www.smashingmagazine.com/2006/12/29/css-based-tables-modern-solutions/">CSS-Based Tables: Technique</a></h4>
<p><a href="http://www.smashingmagazine.com/2006/12/29/css-based-tables-modern-solutions/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5109" title="22css-techniques0025" src="http://technologytosoftware.com/wp-content/uploads/2010/09/22css-techniques0025.gif" alt="" width="485" height="170" /></a></p>
<h4>23. <a href="http://www.webdesignerwall.com/tutorials/css-gradient-text-effect/">CSS Gradient Text Effect</a></h4>
<p><a href="http://www.webdesignerwall.com/tutorials/css-gradient-text-effect/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5110" title="23_css_text_gradient" src="http://technologytosoftware.com/wp-content/uploads/2010/09/23_css_text_gradient.jpg" alt="" width="450" height="180" /></a></p>
<h4>24. <a href="http://mikecherim.com/gbcms_xml/news_page.php?id=24#n24">CSS List Boxes</a></h4>
<p><a href="http://mikecherim.com/gbcms_xml/news_page.php?id=24#n24"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5111" title="24listboxes" src="http://technologytosoftware.com/wp-content/uploads/2010/09/24listboxes.jpg" alt="" width="500" height="113" /></a></p>
<h4>25. <a href="http://mikecherim.com/experiments/css_map_pop.php">CSS Map Pop</a></h4>
<p><a href="http://mikecherim.com/experiments/css_map_pop.php"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5112" title="25css-techniques0021" src="http://technologytosoftware.com/wp-content/uploads/2010/09/25css-techniques0021.gif" alt="" width="485" height="170" /></a></p>
<h4>26. <a href="http://www.askthecssguy.com/2007/09/sangeeta_asks_the_css_guy_how_1.html">CSS Pricing Matrix</a></h4>
<p><a href="http://www.askthecssguy.com/2007/09/sangeeta_asks_the_css_guy_how_1.html"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5113" title="26csspricingmatrix" src="http://technologytosoftware.com/wp-content/uploads/2010/09/26csspricingmatrix.png" alt="" width="438" height="156" /></a></p>
<h4>27. <a href="http://24ways.org/2006/css-production-notes">CSS Production Notes</a></h4>
<p><a href="http://24ways.org/2006/css-production-notes"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5114" title="27" src="http://technologytosoftware.com/wp-content/uploads/2010/09/27.gif" alt="" width="485" height="170" /></a></p>
<h4>28. <a href="http://www.designmeme.com/articles/csspullquotes/">CSS Pull Quotes</a></h4>
<p><a href="http://www.designmeme.com/articles/csspullquotes/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5115" title="28css36" src="http://technologytosoftware.com/wp-content/uploads/2010/09/28css36.png" alt="" width="485" height="170" /></a></p>
<h4>29. <a href="http://www.smileycat.com/miaow/archives/000044.php#nojavascript">CSS Rounded Corners Roundup</a> (Nifty Corners)</h4>
<p><a href="http://www.smileycat.com/miaow/archives/000044.php#nojavascript"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5116" title="29css-techniques0008" src="http://technologytosoftware.com/wp-content/uploads/2010/09/29css-techniques0008.gif" alt="" width="485" height="170" /></a></p>
<h4>30. <a href="http://wordpress.betech.virginia.edu/index.php/2007/10/03/css-sitemap/">CSS SiteMap</a></h4>
<p><a href="http://wordpress.betech.virginia.edu/index.php/2007/10/03/css-sitemap/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5117" title="30css42" src="http://technologytosoftware.com/wp-content/uploads/2010/09/30css42.png" alt="" width="485" height="170" /></a></p>
<h4>31. <a href="http://www.willmayo.com/2007/02/10/css-speech-bubbles/">CSS Speech Bubbles</a></h4>
<p><a href="http://www.willmayo.com/2007/02/10/css-speech-bubbles/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5118" title="31best-of-february-03" src="http://technologytosoftware.com/wp-content/uploads/2010/09/31best-of-february-03.png" alt="" width="485" height="170" /></a></p>
<h4>32. <a href="http://www.thewojogroup.com/2008/12/css-stacked-bar-graphs/">CSS Stacked Bar Graphs</a></h4>
<p><a href="http://www.thewojogroup.com/2008/12/css-stacked-bar-graphs/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5119" title="32stacked-bar-graph" src="http://technologytosoftware.com/wp-content/uploads/2010/09/32stacked-bar-graph.jpg" alt="" width="444" height="305" /></a></p>
<h4>33. <a href="http://codylindley.com/CSS/325/css-step-menu">CSS Step Menu</a></h4>
<p><a href="http://codylindley.com/CSS/325/css-step-menu"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5120" title="33css52" src="http://technologytosoftware.com/wp-content/uploads/2010/09/33css52.png" alt="" width="485" height="170" /></a></p>
<h4>34. <a href="http://exploding-boy.com/images/cssmenus/menus.html">CSS Tabs</a></h4>
<p><a href="http://exploding-boy.com/images/cssmenus/menus.html"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5121" title="34css-techniques0002" src="http://technologytosoftware.com/wp-content/uploads/2010/09/34css-techniques0002.gif" alt="" width="485" height="170" /></a></p>
<h4>35. <a href="http://www.456bereastreet.com/lab/teaser/">CSS Teaser Box</a></h4>
<p><a href="http://www.456bereastreet.com/lab/teaser/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5122" title="35css-techniques0029" src="http://technologytosoftware.com/wp-content/uploads/2010/09/35css-techniques0029.gif" alt="" width="485" height="170" /></a></p>
<h4>36. <a href="http://www.deltatangobravo.com/images/zoom/">CSS Zooming</a></h4>
<p><a href="http://www.deltatangobravo.com/images/zoom/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5123" title="36css-techniques0032" src="http://technologytosoftware.com/wp-content/uploads/2010/09/36css-techniques0032.gif" alt="" width="485" height="170" /></a></p>
<h4>37. <a href="http://mikecherim.com/experiments/css_menu_descriptions.php#">CSS: Menu Descriptions</a></h4>
<p><a href="http://mikecherim.com/experiments/css_menu_descriptions.php#"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5124" title="37css61" src="http://technologytosoftware.com/wp-content/uploads/2010/09/37css61.png" alt="" width="485" height="170" /></a></p>
<h4>38. <a href="http://www.smashingmagazine.com/2006/11/11/css-based-forms-modern-solutions/">CSS-Based Forms: Techniques</a></h4>
<p><a href="http://www.smashingmagazine.com/2006/11/11/css-based-forms-modern-solutions/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5125" title="38css-techniques0024" src="http://technologytosoftware.com/wp-content/uploads/2010/09/38css-techniques0024.gif" alt="" width="485" height="170" /></a></p>
<h4>39. <a href="http://css-tricks.com/date-display-with-sprites/">Date Display Technique with Sprites</a></h4>
<p><a href="http://css-tricks.com/date-display-with-sprites/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5126" title="39Display-Date-Using-Sprites" src="http://technologytosoftware.com/wp-content/uploads/2010/09/39Display-Date-Using-Sprites.png" alt="" width="417" height="165" /></a></p>
<h4>40. <a href="http://www.barenakedapp.com/the-design/displaying-percentages">Displaying Percentages with CSS</a></h4>
<p><a href="http://www.barenakedapp.com/the-design/displaying-percentages"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-5127" title="40css-techniques0036" src="http://technologytosoftware.com/wp-content/uploads/2010/09/40css-techniques0036.gif" alt="" width="485" height="170" /></a></p>
<p>文章来源：<a href="http://technologytosoftware.com/best-css-techniques-you-shouldt-miss-for-effective-coding.html" target="_blank">http://technologytosoftware.com/best-css-techniques-you-shouldt-miss-for-effective-coding.html</a><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/14.jpg" alt="一些有意思的贴子和工具" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_title">一些有意思的贴子和工具</a></li><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/3013.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2010/09/biolab-150x150.jpg" alt="一些非常有意思的杂项资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3013.html" class="wp_rp_title">一些非常有意思的杂项资源</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/3063.html">40个很不错的CSS技术</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/3063.html/feed</wfw:commentRss>
			<slash:comments>10</slash:comments>
		
		
			</item>
		<item>
		<title>一些非常有意思的杂项资源</title>
		<link>https://coolshell.cn/articles/3013.html</link>
					<comments>https://coolshell.cn/articles/3013.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Tue, 28 Sep 2010 00:38:34 +0000</pubDate>
				<category><![CDATA[Ajax开发]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Unix/Linux]]></category>
		<category><![CDATA[Web开发]]></category>
		<category><![CDATA[技术读物]]></category>
		<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[轶事趣闻]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[ebook]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Go]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Structure Synth]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=3013</guid>

					<description><![CDATA[<p>下面是一些最近在互联网上看到的一些各式各样的资源和文章，当然，都是英文社区的，本来想每一个写一篇文章，但是觉得一篇文章一句话真没劲，所以，把这些东西合并写成一篇...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/3013.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/3013.html">一些非常有意思的杂项资源</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>下面是一些最近在互联网上看到的一些各式各样的资源和文章，当然，都是英文社区的，本来想每一个写一篇文章，但是觉得一篇文章一句话真没劲，所以，把这些东西合并写成一篇文章，这样有利于减轻本站的负载，也有利于节省网络带宽，同样，也就节省了能力和电力，因此也就很环保，很低碳。呵呵。</p>
<ul>
<li>先是一个《Windows Internal》第五版的第五章的电子版（英文的），你可以在<a href="http://download.sysinternals.com/Files/WindowsInternals-Ch05.pdf" target="_blank"><strong>这里下载</strong></a>。关于其它一些电子书，你可以看看本站的这篇文章《<a rel="bookmark" href="https://coolshell.cn/articles/2775.html" target="_blank">免费电子书列表</a>》、《<a rel="bookmark" href="https://coolshell.cn/articles/240.html">非常不错的编程技术教程</a>》、《<a rel="bookmark" href="https://coolshell.cn/articles/336.html">超过100本的linux免费书籍</a>》和《<a rel="bookmark" href="https://coolshell.cn/articles/355.html">20本最好的Linux免费书籍</a>》</li>
</ul>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li><a href="http://www.3dtin.com/" target="_blank"><strong>http://www.3dtin.com/</strong></a>是一个用纯Javascript搞的一个3D作图的网站，Javascript是越来越强大了。这个演示可以让你看到以后Web应用的潜力。关于<a href="https://coolshell.cn/articles/tag/javascript" target="_blank">Javascript的一些东西</a>，你可以参看本站的这些文章《<a rel="bookmark" href="https://coolshell.cn/articles/2785.html" target="_blank">JS1K 演示</a>》、《<a rel="bookmark" href="https://coolshell.cn/articles/2276.html" target="_blank">又一个Javascript试验田</a>》、《<a rel="bookmark" href="https://coolshell.cn/articles/2065.html" target="_blank">一个Windows 3.1的Web网站</a>》、《<a rel="bookmark" href="https://coolshell.cn/articles/1932.html" target="_blank">哥是玩程序的</a>》。</li>
</ul>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li>说到这些很酷很炫的东西，大家一定会想到使用Flash，不过，目前的<a href="https://coolshell.cn/articles/2735.html" target="_blank">Flash正在受到HTML5的强力挑战</a>，目前，对于HTML5的展示网站很多，让我们看到了HTML5完全可以做出Flash的样子，比如前些天本站说到的<a href="https://coolshell.cn/articles/2926.html" target="_blank">这个演示</a>，还有给大家展示的<a href="https://coolshell.cn/articles/2998.html" target="_blank">纯HTML5的小游戏</a>，不过，那些都是一些演示和展示罢了。今天在网上看到一个更强大的HTML5游戏，相当有可玩性，大家不妨一去试玩：<strong><a href="http://www.phoboslab.org/biolab/" target="_blank">http://www.phoboslab.org/biolab/</a></strong></li>
</ul>
<p><a href="http://www.phoboslab.org/biolab/"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-3017" title="一个很不错的HTML5游戏" src="https://coolshell.cn/wp-content/uploads/2010/09/biolab.jpg" alt="" width="483" height="321" srcset="https://coolshell.cn/wp-content/uploads/2010/09/biolab.jpg 483w, https://coolshell.cn/wp-content/uploads/2010/09/biolab-300x199.jpg 300w, https://coolshell.cn/wp-content/uploads/2010/09/biolab-406x270.jpg 406w" sizes="(max-width: 483px) 100vw, 483px" /></a></p>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li>HTML5 可以应用的还不只是游戏，这不，<a href="http://thechangelog.com/post/1097381443/vexflow-html5-canvas-javascript-library-music-and-guitar" target="_blank">有文章指出</a>，用<a href="http://www.vexflow.com/" target="_blank"><strong>VexFlow</strong></a>还可以很轻松地在网页上发布乐谱。而<a href="http://stepheneisenhauer.com/demos/drummachine/" target="_blank"><strong>这个网页</strong></a>还可以让你制作Hi-PoP音乐。</li>
</ul>
<p style="text-align: center;"><a href="http://www.vexflow.com/"><img decoding="async" loading="lazy" src="http://cl.ly/c4f966c6d51cfc9be20b/content" alt="Rendered music" width="530" height="240" /></a></p>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li>说到Web开发，就得要提CSS了，这里有一个在线编辑CSS的网站，很不错，<a href="http://css3.mikeplate.com/" target="_blank"><strong>http://css3.mikeplate.com/</strong></a>。关于CSS和Web开发的一些文章，你可以查看本站的<a href="https://coolshell.cn/articles/tag/css" target="_blank">CSS的Tag</a>。现在，这种在线的东西是越来越多了，比如：《<a rel="bookmark" href="https://coolshell.cn/articles/2271.html" target="_blank">Emacs配色在线生成器</a><span style="font-weight: normal; font-size: 13px;">》、《</span><a rel="bookmark" href="https://coolshell.cn/articles/1883.html" target="_blank">Coderun.com 在线开发IDE</a>》、《<a rel="bookmark" href="https://coolshell.cn/articles/1830.html" target="_blank">正则表达式生成器</a>》、《<a rel="bookmark" href="https://coolshell.cn/articles/1611.html" target="_blank">Ajax开发利器UIzard</a>》、《<a rel="bookmark" href="https://coolshell.cn/articles/776.html" target="_blank">一个在线的画UML图的网站</a>》。</li>
</ul>
<p><span id="more-3013"></span></p>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li>说起在线服务，就不得不说说在线代码编译的服务，我觉得这种服务相当好，不需要你在本机安装编译器或IDE，想试试某个语言的语法，真接上网就OK，很方便。以前本站向大家介绍过《<a rel="bookmark" href="https://coolshell.cn/articles/1310.html" target="_blank">在线代码编译服务Codepad.org</a>》其支持：C，C++，D，Haskell，Lua，OCaml，PHP，Perl，Plain Text，Python，Ruby，Scheme，Tcl。当然，在这里，向你介绍一个可以运行Go语言的：<strong><a href="http://golang.org/doc/play/" target="_blank">http://golang.org/doc/play/</a></strong></li>
</ul>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li>说起Web开发，很自然的就能想到UI。下面是一个<a href="http://designingwebinterfaces.com/designing-web-interfaces-12-screen-patterns" target="_blank"><strong>UI的设计Patterns</strong></a>，这篇文章告诉了我们12个比较常用或是经典的图形UI Patterns。关于<a href="https://coolshell.cn/articles/tag/ui" target="_blank">UI方面的话题</a>，你可以参看酷壳的《<a rel="bookmark" href="https://coolshell.cn/articles/363.html" target="_blank">35个强大的UI设计教程</a>》、《<a rel="bookmark" href="https://coolshell.cn/articles/1907.html" target="_blank">UI的恶梦</a>》和《<a rel="bookmark" href="https://coolshell.cn/articles/2313.html" target="_blank">史上最糟糕的网站</a>》。</li>
</ul>
<p><a href="http://designingwebinterfaces.com/designing-web-interfaces-12-screen-patterns"><img decoding="async" loading="lazy" class="aligncenter" title="12个标准的图形UI设计模式" src="http://theresaneil.files.wordpress.com/2008/12/standard_screen_patterns.png" alt="" width="476" height="705" /></a></p>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li>说起Web的界面，最让各位WEB开发者痛苦的就是网页兼容性问题，IE是一个恶梦，因为其自己和自己都不兼容，在MSDN上，有这样的一个网页说明了<a href="http://msdn.microsoft.com/en-us/library/cc351024" target="_blank"><strong>从IE5一直到IE9的CSS的兼容性问题</strong></a>，很多很多的表格，头都看大了。当然，以前本站的《<a rel="bookmark" href="https://coolshell.cn/articles/757.html" target="_blank">检查网页浏览器的兼容性</a>》的文章向你介绍过如何查看网站在不同浏览器中和操作系统下的效果（其也是一个在线服务）。</li>
</ul>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li>当然，Web上的开发，问题最大的还是安全问题，我们的Ruby on Rails给出了一个<a href="http://guides.rubyonrails.org/security.html" target="_blank"><strong>Web安全的开发教程</strong></a>，相当不错哦。谈到了几乎所有最有威胁和最常用的网上攻击，这个文档应该是所有Web开发者都需要注意的。</li>
</ul>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li>下面是一个给新手学习linux用的一个桌面（点击图片看大图），其列出了很多常用的命令，以及VI的常用命令。关于VI的一些东西，你可以查看<a href="https://coolshell.cn/articles/tag/vim" target="_blank">本站的这些文章</a>，如：<a rel="bookmark" href="https://coolshell.cn/articles/1651.html" target="_blank">VIM有趣的命令</a>、<a rel="bookmark" href="https://coolshell.cn/articles/894.html" target="_blank">如何在vim中得到你最喜爱的IDE特性</a></li>
</ul>
<p style="text-align: center;"><a href="http://i.imgur.com/CJkR9.png"><img decoding="async" loading="lazy" class="aligncenter" title="Linux命令桌面" src="http://i.imgur.com/CJkR9.png" alt="" width="553" height="346" /></a></p>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li>最后，给大家介绍一个关于文件格式方面东西，我们知道，很多文件的开头表明着这个文件的类型，所以，有这样的一个网站了维护了这么一个信息列表，其把几乎所有常见的文件头的那段和文件类型相关的Magic Number列了出来，而且还保持更新，非常不错哦，这个网站是：<strong><a href="http://www.garykessler.net/library/file_sigs.html">http://www.garykessler.net/library/file_sigs.html</a><span style="font-weight: normal;">，希望能对你有用哦。</span></strong></li>
</ul>
<p><span style="color: #ffffff;">→</span></p>
<ul>
<li><strong><span style="font-weight: normal;">最最后，给大家介绍一个开源项目，叫<a href="http://structuresynth.sourceforge.net/" target="_blank"><strong>Structure Synth</strong></a>，这个东西可以用来画出一些很酷的图，相当不错，使用起来非常简单，我试用了一下，的确很强大。用一些简单的脚本就可以作出很不错的3D图，下面是他的一个示例，只需要写那么不到10行的代码，很简单。</span></strong></li>
</ul>
<p><a href="http://structuresynth.sourceforge.net/index.php"><img decoding="async" loading="lazy" class="aligncenter size-full wp-image-3018" title="Structure Synth" src="https://coolshell.cn/wp-content/uploads/2010/09/Structure-Synth.jpg" alt="" width="500" height="301" srcset="https://coolshell.cn/wp-content/uploads/2010/09/Structure-Synth.jpg 500w, https://coolshell.cn/wp-content/uploads/2010/09/Structure-Synth-300x180.jpg 300w" sizes="(max-width: 500px) 100vw, 500px" /></a></p>
<p style="padding-left: 60px;">想看看，大家用这个东西做什么酷图了吗？上 <a href="http://www.flickr.com/groups/structuresynth/" target="_blank">http://www.flickr.com/groups/structuresynth/</a> 看看吧。</p>
<p id="pool_4652540301" style="text-align: center;"><a title="structure 作者 Supreet Kumar" href="http://www.flickr.com/photos/9857764@N02/4652540301/in/pool-structuresynth"><img decoding="async" loading="lazy" src="http://farm5.static.flickr.com/4029/4652540301_db50832fdc_t.jpg" border="0" alt="structure 作者 Supreet Kumar" width="100" height="56" /></a> <a title="architecture x-ray 2 作者 Supreet Kumar" href="http://www.flickr.com/photos/9857764@N02/4652540021/in/pool-structuresynth"><img decoding="async" loading="lazy" src="http://farm5.static.flickr.com/4044/4652540021_0f17294ca5_t.jpg" border="0" alt="architecture x-ray 2 作者 Supreet Kumar" width="100" height="62" /></a> <a title="perspective 作者 Supreet Kumar" href="http://www.flickr.com/photos/9857764@N02/4650270228/in/pool-structuresynth"><img decoding="async" loading="lazy" src="http://farm5.static.flickr.com/4002/4650270228_8cc69948bc_t.jpg" border="0" alt="perspective 作者 Supreet Kumar" width="100" height="60" /></a> <a title="snake shade 作者 Supreet Kumar" href="http://www.flickr.com/photos/9857764@N02/4649663253/in/pool-structuresynth"><img decoding="async" loading="lazy" src="http://farm5.static.flickr.com/4042/4649663253_aa041ab239_t.jpg" border="0" alt="snake shade 作者 Supreet Kumar" width="100" height="57" /></a> <a title="thatched beauty 作者 Supreet Kumar" href="http://www.flickr.com/photos/9857764@N02/4641732162/in/pool-structuresynth"><img decoding="async" loading="lazy" src="http://farm4.static.flickr.com/3414/4641732162_e2b078825f_t.jpg" border="0" alt="thatched beauty 作者 Supreet Kumar" width="100" height="63" /></a><br />
<a title="aircraft 作者 Supreet Kumar" href="http://www.flickr.com/photos/9857764@N02/4641055399/in/pool-structuresynth"><img decoding="async" loading="lazy" src="http://farm4.static.flickr.com/3353/4641055399_25688820a9_t.jpg" border="0" alt="aircraft 作者 Supreet Kumar" width="100" height="70" /></a> <a title="aircraft 作者 Supreet Kumar" href="http://www.flickr.com/photos/9857764@N02/4641055019/in/pool-structuresynth"><img decoding="async" loading="lazy" src="http://farm5.static.flickr.com/4064/4641055019_6ed80cd1b9_t.jpg" border="0" alt="aircraft 作者 Supreet Kumar" width="100" height="65" /></a> <a title=" 作者 FracturedPixel" href="http://www.flickr.com/photos/cav666/4640849748/in/pool-structuresynth"><img decoding="async" loading="lazy" src="http://farm5.static.flickr.com/4062/4640849748_0532451842_t.jpg" border="0" alt=" 作者 FracturedPixel" width="100" height="63" /></a> <a title="splash1 作者 Supreet Kumar" href="http://www.flickr.com/photos/9857764@N02/4636427318/in/pool-structuresynth"><img decoding="async" loading="lazy" src="http://farm5.static.flickr.com/4008/4636427318_c84acf4aa4_t.jpg" border="0" alt="splash1 作者 Supreet Kumar" width="100" height="63" /></a> <a title="joy 作者 Supreet Kumar" href="http://www.flickr.com/photos/9857764@N02/4635820649/in/pool-structuresynth"><img decoding="async" loading="lazy" src="http://farm5.static.flickr.com/4012/4635820649_720cd6599b_t.jpg" border="0" alt="joy 作者 Supreet Kumar" width="100" height="53" /></a></p>
<p id="pool_4635820649">（全文完）</p>
<p><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/14.jpg" alt="一些有意思的贴子和工具" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_title">一些有意思的贴子和工具</a></li><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/8170.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/08/ajax_error-150x150.jpg" alt="一次Ajax查错的经历" width="150" height="150" /></a><a href="https://coolshell.cn/articles/8170.html" class="wp_rp_title">一次Ajax查错的经历</a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/5224.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/09/image008-150x150.jpg" alt="一些文章和各种资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/5224.html" class="wp_rp_title">一些文章和各种资源</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/3013.html">一些非常有意思的杂项资源</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/3013.html/feed</wfw:commentRss>
			<slash:comments>45</slash:comments>
		
		
			</item>
		<item>
		<title>写HTML和CSS的新方法</title>
		<link>https://coolshell.cn/articles/2406.html</link>
					<comments>https://coolshell.cn/articles/2406.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Tue, 11 May 2010 00:18:19 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[杂项资源]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Zen]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=2406</guid>

					<description><![CDATA[<p>Zen Coding 一个用来简化编写 HTML，XML， XSL （或是其它一些诸如此类格式的编辑器）。其主要是用一种缩写方式的语法来书写大量重复和无味的HT...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/2406.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/2406.html">写HTML和CSS的新方法</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script></p>
<div id="_mcePaste"><strong><a href="http://code.google.com/p/zen-coding/" target="_blank">Zen Coding</a></strong> 一个用来简化编写 HTML，XML， XSL （或是其它一些诸如此类格式的编辑器）。其主要是用一种缩写方式的语法来书写大量重复和无味的HTML，很像CSS语法。下面是一个例子：</div>
<pre>div#page&gt;div.logo+ul#navigation&gt;li*5&gt;a</pre>
<div>展开后会成为下面这个样子：</div>
<pre data-enlighter-language="html" class="EnlighterJSRAW">
&lt;div id=&quot;page&quot;&gt;
        &lt;div&gt;&lt;/div&gt;
        &lt;ul id=&quot;navigation&quot;&gt;
                &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;&quot;&gt;&lt;/a&gt;&lt;/li&gt;
        &lt;/ul&gt;
&lt;/div&gt;
</pre>
<div id="_mcePaste">可以看出来，#代表ID，&gt;代表下一层。</div>
<div><span id="more-2406"></span></div>
<div>如果你写下：</div>
<pre>select&gt;option#item-$*3</pre>
<div>那么将会得到：</div>
<pre data-enlighter-language="html" class="EnlighterJSRAW">

&lt;select&gt;
	&lt;option id=&quot;item-1&quot;&gt;&lt;/option&gt;
	&lt;option id=&quot;item-2&quot;&gt;&lt;/option&gt;
	&lt;option id=&quot;item-3&quot;&gt;&lt;/option&gt;
&lt;/select&gt;
</pre>
<div>看上去很不错吧。目前，其支持如下的编辑器：</div>
<div>
<p><span style="font-family: arial, sans-serif; line-height: normal;"> </span></p>
<ul>
<li><a style="color: #0000cc;" href="http://code.google.com/p/zen-coding/wiki/AptanaHowToEn">AptanaHowToEn</a></li>
<li><strong>TextMate</strong> (Mac). Available in two flavors: basic snippets (Zen HTML and Zen CSS) and full-featured plugin (ZenCoding for TextMate). <sub>Bundles &gt; Zen Coding menu item</sub></li>
<li><strong>Coda</strong> (Mac) — <a style="color: #0000cc;" rel="nofollow" href="http://github.com/sergeche/tea-for-coda/downloads">external download</a>, via <a style="color: #0000cc;" rel="nofollow" href="http://onecrayon.com/tea/">TEA for Coda</a>. <sub>Plug-ins &gt; TEA for Coda &gt; Zen Coding menu item</sub></li>
<li><strong>Espresso</strong> (Mac) — <a style="color: #0000cc;" rel="nofollow" href="http://github.com/sergeche/tea-for-espresso/downloads">external download</a>, via <a style="color: #0000cc;" rel="nofollow" href="http://onecrayon.com/tea/">TEA for Espresso</a>. Zen Coding is bundled with Espresso by default, but you should upgrade ZC to latest version. <sub>Actions &gt; HTML menu item</sub></li>
<li><strong>Komodo Edit/IDE</strong> (crossplatform) — <a style="color: #0000cc;" rel="nofollow" href="http://community.activestate.com/xpi/zen-coding">external download</a>. <sub>Tools &gt; Zen Coding menu item</sub></li>
<li><strong>Notepad++</strong> (Windows). <sub>Zen Coding menu item</sub></li>
<li><strong>PSPad</strong> (Windows). <sub>Scripts &gt; Zen Coding menu item</sub></li>
<li><strong><tt style="font-size: 13px;">&lt;textarea&gt;</tt></strong> (browser-based). See <a style="color: #0000cc;" rel="nofollow" href="http://zen-coding.ru/textarea/">online demo</a>.</li>
<li><strong>editArea</strong> (browser-based). See <a style="color: #0000cc;" rel="nofollow" href="http://zen-coding.ru/demo/">online demo</a>.</li>
</ul>
</div>
<p>还有下面这些第三方的插件：</p>
<ul>
<li><strong>Dreamweaver</strong> (Windows, Mac)</li>
<li><strong>Sublime Text</strong> (Windows)</li>
<li><strong>UltraEdit</strong> (Windows)</li>
<li><strong>TopStyle</strong> (Windows)</li>
<li><strong>GEdit</strong> (crossplatform) — <a rel="nofollow" href="http://github.com/fmarcia/zen-coding-gedit">Franck Marcia&#8217;s plugin</a>, <a rel="nofollow" href="http://github.com/mikecrittenden/zen-coding-gedit">Mike Crittenden&#8217;s plugin</a></li>
<li><strong>BBEdit/TextWrangler</strong> (Mac) — <a rel="nofollow" href="http://www.angelwatt.com/coding/zen-coding_bbedit.php">external download</a></li>
<li><strong>Visual Studio</strong> (Windows) — <a rel="nofollow" href="http://zencoding.codeplex.com/">external download</a></li>
</ul>
<p><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/14.jpg" alt="一些有意思的贴子和工具" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_title">一些有意思的贴子和工具</a></li><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/3063.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/0.jpg" alt="40个很不错的CSS技术" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3063.html" class="wp_rp_title">40个很不错的CSS技术</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/2406.html">写HTML和CSS的新方法</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/2406.html/feed</wfw:commentRss>
			<slash:comments>20</slash:comments>
		
		
			</item>
		<item>
		<title>纯CSS做的3D效果</title>
		<link>https://coolshell.cn/articles/1962.html</link>
					<comments>https://coolshell.cn/articles/1962.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Wed, 16 Dec 2009 06:04:32 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[CSS]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=1962</guid>

					<description><![CDATA[<p>下面是一个用CSS做的一个3D的效果。你可以使用鼠标在图片中移动来显示这个效果。其实，这个效果只是能过移动图片来产生的。其可以工作在Internet Explo...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/1962.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/1962.html">纯CSS做的3D效果</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>下面是一个用CSS做的一个3D的效果。你可以使用鼠标在图片中移动来显示这个效果。其实，这个效果只是能过移动图片来产生的。其可以工作在Internet Explorer 8, Firefox 3, Opera 9, Safari 3, Chrome 4 和 Konqueror 3.5下。网页在这里：<a href=http://www.romancortes.com/ficheros/meninas.html target=_blank>http://www.romancortes.com/ficheros/meninas.html</a></p>
<p><P align=center><IFRAME src="http://www.romancortes.com/ficheros/meninas.html" frameBorder=0 width=400 height=455 frameborder=no scrolling="no"></IFRAME></P><br />
<!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/6913.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/10.jpg" alt="神奇的CSS形状 " width="150" height="150" /></a><a href="https://coolshell.cn/articles/6913.html" class="wp_rp_title">神奇的CSS形状 </a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/30.jpg" alt="Web开发中需要了解的东西" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6043.html" class="wp_rp_title">Web开发中需要了解的东西</a></li><li ><a href="https://coolshell.cn/articles/5164.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/9.jpg" alt="CSS图形" width="150" height="150" /></a><a href="https://coolshell.cn/articles/5164.html" class="wp_rp_title">CSS图形</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/1962.html">纯CSS做的3D效果</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/1962.html/feed</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
			</item>
		<item>
		<title>Web中的省略号</title>
		<link>https://coolshell.cn/articles/1949.html</link>
					<comments>https://coolshell.cn/articles/1949.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Tue, 15 Dec 2009 00:43:59 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[编程语言]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[ellipsis]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=1949</guid>

					<description><![CDATA[<p>在Web开发中，对于一种情况很常见。那就是，文本太长，而放置文本的容器不够长，而我们又不想让文本换行，所以，我们想使用省略号来解决这个问题。但是，在今天HTML...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/1949.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/1949.html">Web中的省略号</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>在Web开发中，对于一种情况很常见。那就是，文本太长，而放置文本的容器不够长，而我们又不想让文本换行，所以，我们想使用省略号来解决这个问题。但是，在今天HTML的标准中并没有相关的标识或属性让你可以简单地完成这个事。但是我们可以使用CSS样式表来完成这个事，在IE，Safari，Chrome，Opera中都可以。但在Firefox中却不行，但我们可以使用jQuery来解决Firefox不兼容的问题。下面是相关的代码示例。</p>
<p><strong>使用CSS设置省略号</strong></p>
<pre data-enlighter-language="html" class="EnlighterJSRAW">
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
</pre>
<p><span id="more-1949"></span></p>
<ul>
<li><strong>overflow</strong> 属性是必需的，并且属性要是hidden。</li>
<li><strong>white-space: nowrap</strong> 也是必需的。如果文本可以自动换行，就算是不可见，也不会有省略号的。因为文本换行了，所以没有超过容器的尺寸，所以也就不会有省略号了。</li>
<li> <strong>width </strong>属性仅在需要支持IE6时设置。 设置成100%仅是为了解决IE6的不兼容问题。（关于IE中的那些不兼容问题，你可以参看本站的《<a rel="bookmark" href="https://coolshell.cn/articles/1817.html">9个最常见IE的Bug及其fix</a>》）</li>
<li><strong>text-overflow: ellipsis</strong> 就是设置省略号了。目前还不是HTML的标准规范。其是由IE引入的，可以在IE6+，Safari 3.2+和Chrome上工作。</li>
<li><strong>-o-text-overflow: ellipsis</strong> 是 Opera 支持的。可以在 Opera 9.0+使用。</li>
</ul>
<p><strong>使用jQuery设置省略号</strong></p>
<p>正如前面所说过的，Firefox并不支持CSS中的那些省略号设置，因为那并不是标准的HTML规范。所以，我们需要使用jQuery的Javascript来干这个事。你可以下载由Devon Govett写的<a href="http://devongovett.wordpress.com/2009/04/06/text-overflow-ellipsis-for-firefox-via-jquery/">jQuery 省略号插件</a>，于是，你可以简单的把&#8221;ellipsis&#8221;赋给某些元件或是CSS定义，如下所示：</p>
<p>[javascript]$(document).ready(function() {<br />
    $(&#8216;.ellipsis&#8217;).ellipsis();<br />
}[/javascript]</p>
<p>或是</p>
<p>[javascript]$(&quot;span&quot;).ellipsis();[/javascript]<!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/4795.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/7.jpg" alt="开源中最好的Web开发的资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/4795.html" class="wp_rp_title">开源中最好的Web开发的资源</a></li><li ><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/14.jpg" alt="一些有意思的贴子和工具" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_title">一些有意思的贴子和工具</a></li><li ><a href="https://coolshell.cn/articles/3013.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2010/09/biolab-150x150.jpg" alt="一些非常有意思的杂项资源" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3013.html" class="wp_rp_title">一些非常有意思的杂项资源</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/1949.html">Web中的省略号</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/1949.html/feed</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
			</item>
		<item>
		<title>9个最常见IE的Bug及其fix</title>
		<link>https://coolshell.cn/articles/1817.html</link>
					<comments>https://coolshell.cn/articles/1817.html#comments</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Tue, 17 Nov 2009 07:33:02 +0000</pubDate>
				<category><![CDATA[Web开发]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=1817</guid>

					<description><![CDATA[<p>Internet Explorer &#8211; Web程序员的毒药。在IE上开发时间中有超过60%的时间是花在和IE的bug进行搏斗，让你的开发生产率严重下...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/1817.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/1817.html">9个最常见IE的Bug及其fix</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script><img decoding="async" loading="lazy" class="alignright" src="http://nettuts.s3.amazonaws.com/494_ie/images/200x200.jpg" alt="9个最常见IE的Bug及其fix" width="138" height="132" /></p>
<p>Internet Explorer &#8211; Web程序员的毒药。在IE上开发时间中有超过60%的时间是花在和IE的bug进行搏斗，让你的开发生产率严重下降。下面是一个教程，告诉你9个IE上最常见的BUG以及如何解决它们。</p>
<h4>1. 居中布局</h4>
<p>创建一个CSS定义把一个元素放到中间的位置，可能是每一个Web开发人员都会做的事情。最简单的做法是为你的元素增加一个<em>margin: auto;</em> ，然而 IE 6.0 会出现很多奇怪的行为。让我们来看一个例子。</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#container{
	border: solid 1px #000;
	background: #777;
	width: 400px;
	height: 160px;
	margin: 30px 0 0 30px;
}

#element{
	background: #95CFEF;
	border: solid 1px #36F;
	width: 300px;
	height: 100px;
	margin: 30px auto;

}
</pre>
<p>下面是我们所期望的输出：</p>
<p><span id="more-1817"></span></p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/1-1.png" border="0" alt="Tutorial Image" /></div>
<p>但IE却给我们这样的输出：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/1-2.png" border="0" alt="Tutorial Image" /></div>
<p>这应该是IE 6对margin的 <em>auto</em> 并没有正确的设置。但幸运的是，这是很容易被修正的。</p>
<p><strong>解决方法</strong></p>
<p>最简单的方法是在父元件中使用 <em>text-align: center</em> 属性，而在元件中使用 <em>text-align: left</em> 。</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#container{
	border: solid 1px #000;
	background: #777;
	width: 400px;
	height: 160px;
	margin: 30px 0 0 30px;
	text-align: center;
}

#element{
	background: #95CFEF;
	border: solid 1px #36F;
	width: 300px;
	height: 100px;
	margin: 30px 0;
    	text-align: left;

}
</pre>
<h4>2. 楼梯式的效果</h4>
<p>几乎所有的Web开发者都会使用list来创建导航条。下面是你可能会用到的代码：</p>
<pre data-enlighter-language="html" class="EnlighterJSRAW">
    &lt;ul&gt;
        &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;#&quot;&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
</pre>
<p> </p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
ul {
    list-style: none;
}

ul li a {
   	display: block;
   	width: 130px;
	height: 30px;
   	text-align: center;
   	color: #fff;
   	float: left;
	background: #95CFEF;
	border: solid 1px #36F;
	margin: 30px 5px;
}
</pre>
<p>一个符合标准的浏览器会是下面这样：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/2-1.png" alt="Tutorial Image" border="0" /></div>
<p>但IE却是这样的：</p>
<p><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/2-2.png" alt="Tutorial Image" border="0" /></p>
<p>下面是两个解决方法</p>
<p><b>解决方法一</b></p>
<p>设置li元件的float属性。</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
ul li {
	float: left;
}
</pre>
<p><strong>解决方法二</strong></p>
<p>设置 <em>display: inline</em> 属性。</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
ul li {
	display: inline
}
</pre>
<h4>3. float元件的两倍空白</h4>
<p>请看下面的代码：</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element{
	background: #95CFEF;
	width: 300px;
	height: 100px;
	float: left;
	margin: 30px 0 0 30px;
	border: solid 1px #36F;
}
</pre>
<p>期望的结果是：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/3-1.png" border="0" alt="Tutorial Image" /></div>
<p>IE的结果是：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/3-2.png" border="0" alt="Tutorial Image" /></div>
<p><strong>解决方案</strong></p>
<p>和上面那个BUG的解决方案一样，设置 <em>display: inline</em> 属性可以解决问题。</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element{
	background: #95CFEF;
	width: 300px;
	height: 100px;
	float: left;
	margin: 30px 0 0 30px;
	border: solid 1px #36F;
   	display: inline;
}
</pre>
<h4>4. 无法设置微型高度</h4>
<p>我们发现在IE中使用 <em>height: XXpx</em> 这样的属性无法设置比较小的高度。下面是个例子（注意高度是2px）：</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element{
	background: #95CFEF;
	border: solid 1px #36F;
	width: 300px;
	height: 2px;
	margin: 30px 0;
}
</pre>
<p>期望结果： 2px的元件加1px的边框.</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/4-1.png" border="0" alt="Tutorial Image" /></div>
<p>IE的结果：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/4-2.png" border="0" alt="Tutorial Image" /></div>
<p><strong>解决方案一</strong></p>
<p>这个BUG的产生原因很简单，IE不允许元件的高度小于字体的高度，所以，下面的fix是设置上字体大小。</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element{
	background: #95CFEF;
	border: solid 1px #36F;
	width: 300px;
	height: 2px;
	margin: 30px 0;
    	font-size: 0;
}
</pre>
<p><strong>解决方案二</strong></p>
<p>但是最佳的解决方法是使用 <em>overflow: hidden</em> 。</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element{
	background: #95CFEF;
	border: solid 1px #36F;
	width: 300px;
	height: 2px;
	margin: 30px 0;
    	overflow: hidden
}
</pre>
<h4>5. 跨出边界</h4>
<p>这个BUG是很难看的。当父元件中使用了 <em>overflow</em> 的 <em>auto</em> 属性，并且在其里放入相关元件。你会看来里面的元件会跨出来。下面是一个示例：</p>
<pre data-enlighter-language="html" class="EnlighterJSRAW">
&lt;div id=&quot;element&quot;&gt;&lt;div id=&quot;anotherelement&quot;&gt;&lt;/div&gt;&lt;/div&gt;
</pre>
<p> </p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element{
	background: #95CFEF;
	border: solid 1px #36F;
	width: 300px;
	height: 150px;
	margin: 30px 0;
	overflow: auto;
}

#anotherelement{
	background: #555;
	width: 150px;
	height: 175px;
	position: relative;
	margin: 30px;
}
</pre>
<p>期望的结果：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/5-1.png" border="0" alt="Tutorial Image" /></div>
<p>IE的结果：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/5-2.png" border="0" alt="Tutorial Image" /></div>
<p><strong>解决方法</strong></p>
<p>设置 position: relative;属性</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element{
	background: #95CFEF;
	border: solid 1px #36F;
	width: 300px;
	height: 150px;
	margin: 30px 0;
	overflow: auto;
    	position: relative;
}
</pre>
<h4>6. Fixing the Broken Box Model</h4>
<p>Internet Explorer曲解了“盒子模子”可能是最不可原谅的事情了。IE 6 这个半标准的浏览器回避了这个事情，但这个问题还是会因为IE运行在“怪异模式”下出现。</p>
<p>两个Div元件。一个是有fix的，一个是没有的。而他们不同的高和宽加上padding的总合却是不一样的。下图的上方是被修正的，下方则没有。</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/6.png" border="0" alt="Tutorial Image" /></div>
<p><strong>解决方法</strong></p>
<p>我相信这个事情即不需要解释也不需要演示，这应该是大多数人都明白的。下面是一个很相当怪异的解决方案</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element{
	width: 400px;
    	height: 150px;
	padding: 50px;
}
</pre>
<p>上面的定义也就是说：</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element {
    width: 400px;
    height: 150px;
   \height: 250px;
   \width: 500px
}
</pre>
<p>是的，你要原来的长和宽上加上了padding。但这个fix只会作用于IE了的“怪异模式”，所以你不需要担心在IE6的正常模式下会有问题。</p>
<h4>7. 设置min-height和min-width</h4>
<p>IE忽略了min-height。</p>
<p><strong>解决方法一</strong></p>
<p>这个fix由 <a href="http://www.dustindiaz.com/min-height-fast-hack/">Dustin Diaz</a>提供。其利用了 <em>!important</em> 下面是代码片段：</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element {
  min-height:150px;
  height:auto !important;
  height:150px;
}
</pre>
<p><strong>解决方法二</strong></p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element {
    min-height: 150px;
    height: 150px;
}

html&gt;body #element {
	height: auto;
}
</pre>
<h4>8. Float 布局错误行为 Misbehaving</h4>
<p>使用无table的布局最重要的就是使用CSS的float元件。在很多情况下，IE6处理起来好像在摸索阶段，有些时候，你会发现很多奇怪的行为。比如在其中有一些文本的时候。</p>
<p>来看一下下面这个示例：</p>
<pre data-enlighter-language="html" class="EnlighterJSRAW">
&lt;div id=&quot;container&quot;&gt;
	&lt;div id=&quot;element&quot;&gt;http://net.tutsplus.com/&lt;/div&gt;
	&lt;div id=&quot;anotherelement&quot;&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p> </p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element, #anotherelement{
	background: #95CFEF;
	border: solid 1px #36F;
	width: 100px;
	height: 150px;
	margin: 30px;
	padding: 10px;
	float: left;
}

#container{
	background: #C2DFEF;
	border: solid 1px #36F;
	width: 365px;
	margin: 30px;
	padding: 5px;
	overflow: auto;
}
</pre>
<p>期望结果：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/8-1.png" border="0" alt="Tutorial Image" /></div>
<p>IE的结果：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/8-2.png" border="0" alt="Tutorial Image" /></div>
<p>你可以看到其中的不同了</p>
<p><strong>解决方法</strong></p>
<p>要解决这个问题没有什么好的方法。只有一个方法，那就是使用 <em>overflow: hidden</em> 。</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
#element{
	background: #C2DFEF;
	border: solid 1px #36F;
	width: 365px;
	margin: 30px;
	padding: 5px;
	overflow: hidden;
}
</pre>
<h4>9. 在list项目门的空行</h4>
<p>先看下面的例子</p>
<pre data-enlighter-language="html" class="EnlighterJSRAW">
&lt;ul&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Link 1&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Link 2&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;#&quot;&gt;Link 3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre>
<p> </p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
ul {
	margin:0;
	padding:0;
	list-style:none;
}

li a {
	background: #95CFEF;
	display: block;
}
</pre>
<p>期望结果：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/9-1.png" border="0" alt="Tutorial Image" /></div>
<p>IE的结果：</p>
<div class="tutorial_image"><img decoding="async" src="http://nettuts.s3.amazonaws.com/494_ie/images/9-2.png" border="0" alt="Tutorial Image" /></div>
<p>Fortunately, there are a plethora of fixes you could try.</p>
<p><strong>解决方法一</strong></p>
<p>定义height来解决</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
li a {
	background: #95CFEF;
	display: block;
    	height: 200px;
}
</pre>
<p><strong>解决方法二</strong></p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
li a {
	background: #95CFEF;
	float: left;
    	clear: left;
}
</pre>
<p><strong>解决方法三</strong></p>
<p>为 <em>li</em> 加上<em>display: inline</em>。</p>
<pre data-enlighter-language="css" class="EnlighterJSRAW">
li {
	display: inline;
}
</pre>
<h4>结论</h4>
<p>调界面是一件很难的事，调一个CSS的HTML界面是一件更难的事，在IE下调一个CSS的HTML界面是难上加难的事。</p>
<p>文章：<a href="http://net.tutsplus.com/tutorials/html-css-techniques/9-most-common-ie-bugs-and-how-to-fix-them/" target="_blank">来源</a><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" ><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/01/pretty-code-150x150.gif" alt="Chrome开发者工具的小技巧" width="150" height="150" /></a><a href="https://coolshell.cn/articles/17634.html" class="wp_rp_title">Chrome开发者工具的小技巧</a></li><li ><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2013/05/Render-Process-150x150.jpg" alt="浏览器的渲染原理简介" width="150" height="150" /></a><a href="https://coolshell.cn/articles/9666.html" class="wp_rp_title">浏览器的渲染原理简介</a></li><li ><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2012/03/css-layouts-150x150.gif" alt="CSS 布局:40个教程、技巧、例子和最佳实践" width="150" height="150" /></a><a href="https://coolshell.cn/articles/6840.html" class="wp_rp_title">CSS 布局:40个教程、技巧、例子和最佳实践</a></li><li ><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/14.jpg" alt="一些有意思的贴子和工具" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3903.html" class="wp_rp_title">一些有意思的贴子和工具</a></li><li ><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2011/02/1128-150x150.jpg" alt="Web开发人员速查卡" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3684.html" class="wp_rp_title">Web开发人员速查卡</a></li><li ><a href="https://coolshell.cn/articles/3063.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/0.jpg" alt="40个很不错的CSS技术" width="150" height="150" /></a><a href="https://coolshell.cn/articles/3063.html" class="wp_rp_title">40个很不错的CSS技术</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/1817.html">9个最常见IE的Bug及其fix</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/1817.html/feed</wfw:commentRss>
			<slash:comments>22</slash:comments>
		
		
			</item>
	</channel>
</rss>
