会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132384个问题
JAVA 全系列/第十一阶段:分布式RPC调用和分布式文件存储/FastDFS 10996楼

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>横向布局的导航栏</title>
</head>
<!--<style>
    ul{list-style: none;padding: 0;margin: 0;}
    ul li{display:inline-block; width:100px; height:100px;line-height:30px;text-align:center; background-color:skyblue;}
    li a{text-decoration: none;color: white;}
    li:hover{background-color: red;}
    li:hover a{color: greenyellow;}
</style>-->
<style>
    li:hover{background-color: red}
    li:hover a{color: greenyellow}
</style>
<body>
 <!--   <ul>
        <li><a href="#">首页</a></li>
        <li><a href="#">军事</a></li>
        <li><a href="#">新闻</a></li>
        <li><a href="#">娱乐</a></li>
    </ul>-->
<script>
    var arr=['首页','军事','娱乐','新闻',];
    //创建ul标签
    var ul=document.createElement('ul');
    var ul_style=document.createAttribute('style');
    ul_style.value='list-style: none;padding: 0;margin: 0;';
    ul.setAttributeNode(ul_style);

      //创建li标签
        for(var i=0;i<4;i++){
            var li=document.createElement('li');
            var li_style=document.createAttribute('style');
            li_style.value='display:inline-block; width:100px; height:100px;line-height:30px;text-align:center;/ background-color:skyblue;';
            li.setAttributeNode(li_style);
            ul.appendChild(li);

      //创建a标签

            var a=document.createElement('a');
            var a_style=document.createAttribute('style');
            a_style.value='text-decoration: none;color: white;';
            a.setAttributeNode(a_style);
            li.appendChild(a);
            a.innerHTML=arr[i];

        }
  document.body.appendChild(ul);

</script>
</body>
</html>
哪里的问题,我的不显示出来


WEB前端全系列/第二阶段:JavaScript编程模块/DOM模型 10998楼
Python 全系列/第三阶段:Python 网络与并发编程/网络通信 10999楼
JAVA 全系列/第二十一阶段:分布式医疗云平台/基础功能搭建 11006楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/IO 流技术(旧) 11007楼
WEB前端全系列/第十四阶段:微信小程序/小程序API 11008楼
Python 全系列/第二十三阶段:人工智能基础_机器学习理论和实战(旧)/代码实战梯度下降法与优化 11009楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637