CSS3 渐变(Gradients)
参考:
http://www.runoob.com/css3/css3-gradients.html
CSS3 渐变(gradients)可以让你在两个或多个指定的颜色之间显示平稳的过渡。
以前,你必须使用图像来实现这些效果。但是,通过使用 CSS3 渐变(gradients),你可以减少下载的事件和宽带的使用。此外,渐变效果的元素在放大时看起来效果更好,因为渐变(gradient)是由浏览器生成的。
CSS3 定义了两种类型的渐变(gradients):
- 线性渐变(Linear Gradients)- 向下/向上/向左/向右/对角方向
- 径向渐变(Radial Gradients)- 由它们的中心定义
CSS3 线性渐变
为了创建一个线性渐变,你必须至少定义两种颜色结点。颜色结点即你想要呈现平稳过渡的颜色。同时,你也可以设置一个起点和一个方向(或一个角度)。
线性渐变的实例:
语法
background: linear-gradient(direction, color-stop1, color-stop2, ...);
线性渐变 - 从上到下(默认情况下)
下面的实例演示了从顶部开始的线性渐变。起点是红色,慢慢过渡到蓝色:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<style>
#grad1 {
height: 200px;
background: -webkit-linear-gradient(red, blue); /* Safari 5.1 - 6.0 */
background: -o-linear-gradient(red, blue); /* Opera 11.1 - 12.0 */
background: -moz-linear-gradient(red, blue); /* Firefox 3.6 - 15 */
background: linear-gradient(red, blue); /* 标准的语法(必须放在最后) */
}
</style>
</head>
<body> <h3>线性渐变 - 从上到下</h3>
<p>从顶部开始的线性渐变。起点是红色,慢慢过渡到蓝色:</p> <div id="grad1"></div> <p><strong>注意:</strong> Internet Explorer 9 及之前的版本不支持渐变。</p> </body>
</html>
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlIAAAENCAIAAABLjRybAAARj0lEQVR4nO3ddagta/kH8EdFfyomJiYmJtvCxMbExERdiomJiYmJtTExMTEx0a1iY2JiolvFxMTExMT4/bFrzax3Yj3nnHt57vp8+fxx7lp7zcyateb9zryzzz3xPxERkY1JnNwbICIictJF7YmIyAZF7YmIyAZF7YmIyAalX3sRilBERE6xadSe5pMNy84iYm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fgoA5SRr7wLxMwAoJ1l754+fA0A5ydo7X/wCAMpJ1t5545cAUE6y9s4TvwKAcpK1d+74NQCUk6y9c8VvAKCcZO2dM34LAOUka+8c8TsAKCdZe2eP3wNAOcnaO1v8AQDKSdbeWeOPAFBOsvbOEn8CgHKStXfm+DMAlJOsvTPFXwCgnGTtnTH+CgDlJGvvDPE3ACgnWXunj78DQDnJ2vu/+AcAlJOsvdPFPwGgnGTtnTb+BQDlJGvvNPFvACgnWXunjv8AQDnJ2jtV/BcAyknWnoiIyCkpak9ERDYoak9ERDYoak9ERDYoak9ERDYoak9ERDYoak9ERDYo/w/NhWNssTHWTgAAAABJRU5ErkJggg==" alt="" />
线性渐变 - 从左到右
下面的实例演示了从左边开始的线性渐变。起点是红色,慢慢过渡到蓝色:
#grad {
background: -webkit-linear-gradient(left, red , blue); /* Safari 5.1 - 6.0 */
background: -o-linear-gradient(right, red, blue); /* Opera 11.1 - 12.0 */
background: -moz-linear-gradient(right, red, blue); /* Firefox 3.6 - 15 */
background: linear-gradient(to right, red , blue); /* 标准的语法 */
}
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlAAAADkCAIAAADYRI1YAAANuUlEQVR4nO3X2RcQ0hrG4deQJEmmJCQVoSjKmJAkyZSEhJAkhBCZiyJJkiRJpiQkJMlMiKIIRSVTCCHJlHAu9rk4x8W5PkvPu34Xe63vD3jWzl//sSR/e5iZmf0z9l+wAc/MzP6p+ztsSf6tXfJnVvszq/2R1Usrs8bKrPF71vw9a65IhRWp8FvWKv2air+m4i9Z+5es/XMq/ZxKP2Wd0vJUXp7KP2bdH7PuslRZlio/ZL3S0lRdmqrfZ/3vs/53qfZdqn2bDUpLsuGSbPhNNvomG32djb/Oxl9lk9LiVF+c6l9m0y+z6Rep8UVqfJ7NSotSc1FqfpbNP8vmn2aLT7PFJ9my9HFqfZxaH2Wrj7LVwtRemNofZuvSgtRZkDrzU3d+6s5LvXmp90G2Kb2fbd/PtnNTf27qz8l2c7Lde9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7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAc84AEPeMADHvCABzzgAQ94wAMe8IAHPOABD3jAAx7wgAe8/2fwzMzM/kEDnpmZrRIDnpmZrRIDnpmZrRIDnpmZrRIDnpmZrRIDnpmZrRIDnpmZrRL7Fwjad4NU7TaqAAAAAElFTkSuQmCC" alt="" />
线性渐变 - 对角
你可以通过指定水平和垂直的起始位置来制作一个对角渐变。
下面的实例演示了从左上角开始(到右下角)的线性渐变。起点是红色,慢慢过渡到蓝色:
#grad {
background: -webkit-linear-gradient(left top, red , blue); /* Safari 5.1 - 6.0 */
background: -o-linear-gradient(bottom right, red, blue); /* Opera 11.1 - 12.0 */
background: -moz-linear-gradient(bottom right, red, blue); /* Firefox 3.6 - 15 */
background: linear-gradient(to bottom right, red , blue); /* 标准的语法 */
}
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkYAAADqCAIAAADI/h2HAAAeRklEQVR4nO2Y+duvY/WGV4QIEWUqosgYmSlTEUWEjJmKKCIzZdjbUGYiiihTxhBRRJnKTGSMIsoUIkSIvt8f7qO7te73fvZe+30/w/Os61rH9Qes387jPOX/eDwej8cLcTLsB3g8Ho/H680RaTwej8cLckQaj8fj8YIckcbj8Xi8IEek8Xg8Hi/IEWk8Ho/HC3JEGo/H4/GCHJHG4/F4vCBHpPF4PB4vyBFpPB6PxwtyCmki/5G35b0lk+m9KZPn/VverveGTJH3ukzxukyZ95pMpfcveUfeqzK13isyTd4/5Z16L8u0eS/JdHovyvR5/5B36b0gM+Q9LzPq/V3enfeczKT3rMyc94y8R+9v8t68p2UWvadk1rwnZTa9J2T2vMdlDr2/yvvy/iLv13tM5sx7VObS+7N8IO8RmVvvYZkn70/yQb0/yofyHpJ59R6U+fL+IB/We0Dmz7tfFtC7TxbMu1cWvFcWyrtHFta7WxbJ+718RO8uWTTvTllM73fy0bw7ZHG922WJvNtkSb1bZam8W2RpvZtlmbybZFm9G2W5vBtkeb3fysfyfiMf17teVsi7TlbUu1ZWyrtGVta7WlbJ+7V8Qu9X8sm8q2RVvStltbxfyqf0rpDV8y6XNfR+IZ/O+7l8Ru8yWTPvUllL72fy2bxLZG29i2WdvJ/K5/QuknX1LpT18i6Q9fV+Ip/PO1820DtPNsw7VzbSO0c2zjtbNtE7SzbN+7F8Qe9M2SzvDNlc73TZIu802VLvVNkq70fyRb0fypfyTpGt9U6WbfJ+IF/WO0m2zTtRttP7vnwl73vyVb0TZPu842UHve/K1/KOkx31jpWd8r4jX9c7RnbOO1p20TtKds07UnbTO0J2zztc9tA7TPbUO1T2yjtE9tb7tnwj71vyTb2DZZ+8g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yMYyRZLC1jYHSSDELLGBgtySC0rJ2BsSBZXh1pXdAyBkZNMhAtY2B0kSyWljEwukgGomWaZAXMppFXppFXKkjrKckgtIyB0ZIMRMsYGDXJQLSMgdFFskFqWYZZI9KiBsZYWsbA6CQZhJYxMFqSQWgZeGAsSDa1vDK1vDq1vNqINAbGXpAMRMsYGF0ki6VlDIwukoFo2eADo4LZq3nvkH9VkBZGyxgYLclAtIyBUZMMRMsYGF0ki6VlrxYwS6sjbZAki6VlDIwukoFoGQOjJRmEljEwWpL1Xcv0ppLXKkgDCIwgWsbA6CJZLC1jYHSRDETLAgfGgmR5daQxMA6QZBBaxsBoSQaiZQyMLpLF0rIBBcaCZFPJa1PK61PK6xWkRdQyBkYXyUC0jIHRkgxCyxgYLcniaFkiWV4FacMjGYiWMTC6SBZLyxgYXSQD0TIGRkuyMWlZ2hTyRloj0uADI4SWMTBakoFoGQOji2SxtCxaYCxIlvZ2+XcFaQyMbSMZiJYxMFqSQWgZA6MlGYiW9SAwFiTLqyPNSbJYWsbA6CJZLC1jYHSRDETLGBgtybqhZXmTy5uTy5sVpLU7MEJoGQOjJRmIljEwukgWS8sYGF0km4CWZZg1Io2B0UkyEC1jYLQkg9AyBkZLMhAt61JgLEg2mbyV1oi01mgZA6OLZLG0jIHRRTIQLWNgtCSD0LKJBsaRMJtM3nqb/KeCtFGRDELLGBgtyUC0jIHRRbJYWsbA6CJZG7QswyytjrROB0YQLWNgtCSD0DIGRksyEC1jYJw4ydLkfxxTSOPxeDwer9NHpPF4PB4vyBFpPB6PxwtyRBqPx+PxghyRxuPxeLwg9/9Br6+AkVjhGAAAAABJRU5ErkJggg==" alt="" />
使用透明度(transparent)
CSS3 渐变也支持透明度(transparent),可用于创建减弱变淡的效果。
为了添加透明度,我们使用 rgba() 函数来定义颜色结点。rgba() 函数中的最后一个参数可以是从 0 到 1 的值,它定义了颜色的透明度:0 表示完全透明,1 表示完全不透明。
下面的实例演示了从左边开始的线性渐变。起点是完全透明,慢慢过渡到完全不透明的红色:
#grad {
background: -webkit-linear-gradient(left,rgba(255,0,0,0),rgba(255,0,0,1)); /* Safari 5.1 - 6 */
background: -o-linear-gradient(right,rgba(255,0,0,0),rgba(255,0,0,1)); /* Opera 11.1 - 12*/
background: -moz-linear-gradient(right,rgba(255,0,0,0),rgba(255,0,0,1)); /* Firefox 3.6 - 15*/
background: linear-gradient(to right, rgba(255,0,0,0), rgba(255,0,0,1)); /* 标准的语法 */
}
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlYAAADjCAIAAADIX82nAAAOPUlEQVR4nO3V9xcX8gLG8ZQRGcnOyCojm0qRUELIXiF7pxJJyKZUZimUyt57h4yMIiOVMlIUISMrFD33h+/n3HvuOd+f7rn3uvf0es77D3h+e9WImZnZQrkaf/UBMzOzv2YINDOzhXQINDOzhXT/EoELFmTBgvz5Z+mPP/LHH5k/P/PnZ968zJuX338v/fZbfvstv/6aX3/N3LmZOze//FL6+ef8/HN++ik//ZQff8yPP+aHH0pz5mTOnHz/fb7/Pt99l+++y7fflr75Jt98k9mzM3t2vv46X3+dr74qffllvvwys2Zl1qx88UW++CKff16aOTMzZ2bGjMyYkc8+K336aT79NNOnZ/r0TJuWadPyySelqVMzdWo+/jgff5yPPspHH+XDD0sffJAPPsiUKZkyJZMnZ/LkvP9+adKkTJqUiRMzcWImTMiECXnvvdL48Rk/Pu++m3ffzTvv5J138vbbpbfeyltvZdy4jBuXN9/Mm2/mjTdKY8dm7NiMGZMxY/L663n99bz2WunVV/Pqq3nllbzySkaPzujRefnl0ksv5aWX8uKLefHFvPBCadSojBqV55/P88/nuedKzz6bZ5/NyJEZOTLPPFN6+uk8/XSeeipPPZUnn8yTT+aJJ0qPP57HH89jj+Wxx/Loo3n00TzySOnhh/Pww3nooTz0UB58MA8+mAceKN1/f+6/P/fdl/vuy7335t57c889pbvvzt135667ctddufPO3Hln7rijdPvtuf323HZbbrstt96aW2/NLbeURozIiBEZPjzDh2fYsAwblptvLg0dmqFDM2RIhgzJTTflppty442lG27IDTdk8OAMHpxBgzJoUK6/vjRwYAYOzIABGTAg112X667LtdeWrrkm11yTq6/O1Vfnqqty1VW58spS//7p3z/9+qVfv/Ttm759c8UVpT590qdPevdO7965/PJcfnkuu6x06aW59NJcckkuuSQXX5yLL85FF5UuvPAfXXBBLrgg55+f889Pr17p1SvnnVc699yce27OOSfnnJOePdOzZ84+u9SjR3r0yFln5ayz0r17unfPmWeWzjgjZ5yRbt3SrVtOP73UtWu6dk2XLunSJZ07p3PnnHZaqVOndOqUU0/NqafmlFNyyik5+eTSSSflpJNy4ok58cSccEJOOCHHH1867rgcd1yOPTbHHptjjskxx+Too0tHHZWjjsqRR+bII9OxYzp2zBFHlA4/PIcfnsMOy2GHpUOHdOiQQw8tHXJIDjkkBx+cgw/OQQfloINy4IGlAw7IAQdk//2z//7Zb7/st1/23be0zz7ZZ5/svXf23jvt26d9++y1V2nPPbPnntljj+yxR9q1S7t22X330m67Zbfdsuuu2XXXtG2btm2zyy6lNm3Spk1at07r1tl55+y8c3baqbTjjqVWrdKqVXbYITvskJYt07Jltt++tN122W67tGiRFi3SvHmaN8+225aaNUuzZmnaNE2bpkmTNGmSbbYpbb11tt46W22VrbbKlltmyy2zxRalzTfP5ptns82y2WbZdNNsumk22aTUuHEaN87GG2fjjbPRRtloo2y4YWmDDbLBBmnUKI0apWHDNGyY9dcvrbde1lsv666bddfNOutknXWy9tqlBg3SoEHWWitrrZU118yaa2aNNUqrr57VV0/9+qlfP6utltVWy6qrllZZJauskpVXzsorZ6WVstJKWXHF0gorZIUVUq9e6tXL8suX6tZN3bpZbrkst1yWXTbLLptlliktvXSWXjp16qROnSy1VJZaKksuWapdO7VrZ4klssQSWXzxLL54FlustOiiWXTR1KqVWrVSs2Zq1swii2SRRRA445/8q0pgxb+qBFb8q0pgxb+qBFb8q0pgxb+qBFb8+y8TWPGvKoEV/6oSWPGvKoEV/6oSWPGvKoEV/6oSWPGvKoEV/6oSWPGvKoEV/6oSWPGvKoEV/6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CEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhGIQAQiEIEIRCACEYhABCIQgQhEIAIRiEAEIhCBCEQgAhG40BNoZmb2/z8EmpnZQjoEmpnZQjoEmpnZQjoEmpnZQrq/AYPxwzjls+vXAAAAAElFTkSuQmCC" alt="" />
CSS3 渐变(Gradients)的更多相关文章
- Css3渐变(Gradients)-径向渐变
CSS3径向渐变-radial-gradient()/repeating-radial-gradient() 径向渐变由它的中心定义. 创建径向渐变,至少定义两种颜色节点,呈现平稳过度的颜色.同时,你 ...
- CSS3渐变(Gradients)-线性渐变
CSS3渐变(Gradients)可以让你在两个或多个指定颜色之间显示平稳的过度,包括透明度. 以前,你必须使用图像来实现这些效果.但是,通过Css3渐变(Gradients),你可以减少下载的事件和 ...
- css3渐变(Gradients)
<html> http://www.runoob.com/css3/css3-gradients.html CSS3 渐变(gradients)可以让你在两个或多个指定的颜色之间显示平稳的 ...
- Css3渐变实例Demo(一)
1.指定渐变背景的大小 .div { background: url(../img/1.jpg); /*background-size:contain;*/ width: 500px; height: ...
- Westciv Tools主要为CSS3提供了渐变gradients、盒子阴影box-shadow、变形transform和文字描边四种在线生成效果的工具
Westciv Tools主要为CSS3提供了渐变gradients.盒子阴影box-shadow.变形transform和文字描边四种在线生成效果的工具 1.Westciv Tools 彩蛋爆料直击 ...
- CSS3:CSS3 渐变(Gradients)
ylbtech-CSS3:CSS3 渐变(Gradients) 1.返回顶部 1. CSS3 渐变(Gradients) CSS3 渐变(gradients)可以让你在两个或多个指定的颜色之间显示平稳 ...
- Web前端方向课程要点:CSS3渐变制作过程
CSS3 渐变 CSS3 渐变(gradient)可以让你在两个或多个指定的颜色之间显示平稳的过渡. 以前,你必须使用图像来实现这些效果,现在通过使用 CSS3 的渐变(gradients)即可实现. ...
- 14:CSS3 渐变(gradient)与 过度(transition)、CSS3 的2D动画
14:CSS3 渐变 CSS3 渐变(gradient)可以让你在两个或多个指定的颜色之间显示平稳的过渡. 以前,你必须使用图像来实现这些效果,现在通过使用 CSS3 的渐变(gradients)即可 ...
- CSS-3 渐变的使用
CSS3 渐变(gradients)可以让您在两个或多个指定的颜色之间显示平稳的过渡. 以前,您必须使用图像来实现这些效果.但是,通过使用 CSS3 渐变(gradients),您可以减少下载的事件和 ...
随机推荐
- python 基础篇 13 迭代器与生成器
13. 前⽅⾼能-迭代器和⽣成器本节主要内容:1. 迭代器2. ⽣成器 ⼀. 迭代器我们之前⼀直在⽤可迭代对象进⾏迭代操作. 那么到底什么是可迭代对象. 本⼩节主要讨论可迭代对象. ⾸先我们先回顾⼀下 ...
- 洛谷P2346四子连棋
题目描述 在一个4*4的棋盘上摆放了14颗棋子,其中有7颗白色棋子,7颗黑色棋子,有两个空白地带,任何一颗黑白棋子都可以向上下左右四个方向移动到相邻的空格,这叫行棋一步. 黑白双方交替走棋,任意一方可 ...
- LeetCode 74——搜索二维矩阵
1. 题目 2. 解答 若矩阵为空,比如 [], [[]],此时直接返回 false. 若目标值小于矩阵第一个元素或者大于矩阵最后一个元素,则目标值不在矩阵范围内,直接返回 false. 其他情况下, ...
- c语言第五次作业-指针-总结博客
本次作业亮点 1.1整体情况 本次作业主要是对上次的大作业利用指针进行改进,但是大部分同学并没有很好按照老师的要求对大作业进行改进,函数的分装性也做得不够好,由于是初步学习指针,大家在本次的作业改造中 ...
- Android调用Java WebSevice篇之二
1.创建Activity. package com.web; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapO ...
- delphi保存文件的命名规则
没有固定的标准.自己可以定义 .你可以参考PASCAL命名法则.查一下PASCAL命名. 我习惯用UMain,FMain,UDM,DM,UAboutBox,AboutBox.....程序相关内容都放在 ...
- 创建一个doc对象时候 如果读取了一个已存在的xml对象时候 该xml对象的结构已存在doc中 当改变该doc结构时候 不需要创建新的doc对象
创建一个doc对象时候 如果读取了一个已存在的xml对象时候 该xml对象的结构已存在doc中 当改变该doc结构时候不 需要创建新的doc对象 直接添加即可 他会同步过去
- jQuery插件jquery.fullPage.js
简介如今我们经常能看到全屏网站,尤其是国外网站.这些网站用几幅很大的图片或者色块做背景,再添加一些简单的内容,显得格外的高端大气上档次,比如 iPone 5C 的介绍页面.QQ浏览器的官方网站.百度史 ...
- Antlr 在 idea 中正确使用的方式
问题 Caused by: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN ...
- JS格式化 /Date(xxxxxx)/的日期类型
//用来转换/Date(xxxxxx)/类型的JSON日期为要求的日期格式字符串String.prototype._formatJsonDate = function (format) { var s ...