SOURCE

console 命令行工具 X clear

                    
>
console

var arr = [{name:"北京",url:""},{name:"上海",url:""},{name:"四川",url:""},{name:"湖南",url:""},{name:"重庆",url:""},{name:"广西",url:""},{name:"广东",url:""},{name:"贵州",url:""},{name:"湖北",url:""},{name:"海南",url:""}];
var str = '';
for(var i = 0;i<arr.length;i++){
  str += '<div class="nav-box">'+arr[i].name+'<img class="arrow" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAQCAYAAAAvf+5AAAAAAXNSR0IArs4c6QAAAI5JREFUKBVjYACCM2fONF+4cEEbxMYFmICKKoGSNX///t2PTzETUNECIL75//9/UXyKGYGKQFZLAqn9QKzOyMj4mpmZ2dHAwOAqSA4GwApBHEKK4QoJKUZRiE8xhkJcikG+JgpgmIjLUygKcSkCWQlXiE8RXCEhRWCFxCgCKQT5OgGIcUYdUA4BgKYSTGYAegtdXEcqVVsAAAAASUVORK5CYII=" alt="arrow"></div>'
};
document.getElementById("nav").innerHTML = str
<div id="nav"></div>
/* #nav{
  display:inline-block
} */
.nav-box {
  display:inline-block;
    position: relative;
    flex: 1 1;
    width: 23%;
    max-width: 50%;
    height: 36px;
    margin-right: 2%;
  margin-bottom:5px;
    color: #333;
    font-size: 14px;
    line-height: 36px;
    text-align: center;
    background: #fff;
    border: 1px solid #ebebeb;
    border-radius: 18px;
  box-sizing:border-box;
}
.nav-box .arrow {
    position: relative;
    top: -1px;
    width: 6px;
    height: 9px;
    right: -16px;
  
}