用ul做一个云标签

效果


Paste_Image.png

1、控制位置

ul>li 去掉原本样式

ul { list-style: none; }

ul>li 背景

.cloud ul li:nth-child(8n-7) {/* background: #8A9B0F; */}
  .cloud ul li:nth-child(8n-6) { background: #EB6841 }
  .cloud ul li:nth-child(8n-5) { background: #3FB8AF }
  .cloud ul li:nth-child(8n-4) { background: #FE4365 }
  .cloud ul li:nth-child(8n-3) { background: #FC9D9A }
  .cloud ul li:nth-child(8n-2) {background: #EDC951;}
  .cloud ul li:nth-child(8n-1) { background: #C8C8A9 }
  .cloud ul li:nth-child(8n) { background: #83AF9B }
  .cloud ul li:first-child {/* background: #036564 */}
  .cloud ul li:last-child { background: #3299BB }

ul>li 不独占一行

float: left;
<html>
<meta charset="utf-8">
<body>
<style>
.cloud{
  width: 300px; */
  margin-left: 100px;
  margin-top: 100px;
  background-color: beige;
}
.cloud ul { list-style: none; }
.cloud ul li {
  -o-transition: all 0.5s;
  background: #FC9D9A;
  margin: 2px;
  line-height: 24px;
  float: left;
  border-radius: 8px;
  margin: 10px 10px 0 0;
  padding: 3px 5px;
  -moz-transition: all 0.5s;
}
.cloud ul li a {
    color: #FFF;
}
.cloud a:link, a:visited {
  text-decoration: none;
}
.cloud ul li:nth-child(8n-7) {/* background: #8A9B0F; */}
.cloud ul li:nth-child(8n-6) { background: #EB6841 }
.cloud ul li:nth-child(8n-5) { background: #3FB8AF }
.cloud ul li:nth-child(8n-4) { background: #FE4365 }
.cloud ul li:nth-child(8n-3) { background: #FC9D9A }
.cloud ul li:nth-child(8n-2) {background: #EDC951;}
.cloud ul li:nth-child(8n-1) { background: #C8C8A9 }
.cloud ul li:nth-child(8n) { background: #83AF9B }
.cloud ul li:first-child {/* background: #036564 */}
.cloud ul li:last-child { background: #3299BB }
.cloud ul li:hover { border-radius: 0; text-shadow: #000 1px 1px 1px }

</style>
<div class="cloud">
    <ul>
      <li><a href="/">个人博客</a></li>
      <li><a href="/">web开发</a></li>
      <li><a href="/">前端设计</a></li>
      <li><a href="/">Html</a></li>
      <li><a href="/">CSS3</a></li>
      <li><a href="/">Html5+css3</a></li>
      <li><a href="/">百度</a></li>
      <li><a href="/">Javasript</a></li>
      <li><a href="/">web开发</a></li>
      <li><a href="/">前端设计</a></li>
      <li><a href="/">Html</a></li>
      <li><a href="/">CSS3</a></li>
      <li><a href="/">Html5+css3</a></li>
      <li><a href="/">百度</a></li>
    </ul>
  </div>
</body>
</html>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 问答题47 /72 常见浏览器兼容性问题与解决方案? 参考答案 (1)浏览器兼容问题一:不同浏览器的标签默认的外补...
    _Yfling阅读 13,796评论 1 92
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,179评论 25 708
  • •前端面试题汇总 一、HTML和CSS 21 你做的页面在哪些流览器测试过?这些浏览器的内核分别是什么? ...
    Simon_s阅读 2,228评论 0 8
  • 一:在制作一个Web应用或Web站点的过程中,你是如何考虑他的UI、安全性、高性能、SEO、可维护性以及技术因素的...
    Arno_z阅读 1,212评论 0 1
  • 宋澎
    冰风落叶阅读 197评论 0 0