老师,我想问下如下图这种情况是为什么
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | <!DOCTYPE html> <html> <head> <meta charset= "UTF-8" > <title>慕课轮播图</title> <link rel= "stylesheet" href= "css/style.css" > </head> <body> <div class= "main" > <!--子菜单 --> <div class= "sub-menu" > <div class= "sub-top" > <div class= "items1" > <div class= "title" >前沿技术</div> <div class= "line" ></div> </div> <div class= "items2" ></div> </div> <div class= "sub-buttom" ></div> </div> <!--菜单栏--> <div class= "menu" > <div class= "menu-item" > <a href= "" > <span>前沿</span> <span>/</span> <span>区块链</span> <span>/</span> <span>人工智能</span> <i> 60 c;</i> </a> </div> <div class= "menu-item" > <a href= "" > <span>前端</span> <span>/</span> <span>小程勋</span> <span>/</span> <span>JS</span> <i> 60 c;</i> </a> </div> <div class= "menu-item" > <a href= "" > <span>后端</span> <span>/</span> <span>JAVA</span> <span>/</span> <span>Python</span> <i> 60 c;</i> </a> </div> <div class= "menu-item" > <a href= "" > <span>移动</span> <span>/</span> <span>Andrion</span> <span>/</span> <span>iOS</span> <i> 60 c;</i> </a> </div> <div class= "menu-item" > <a href= "" > <span>云计算</span> <span>/</span> <span>大数据</span> <span>/</span> <span>容器</span> <i> 60 c;</i> </a> </div> <div class= "menu-item" > <a href= "" > <span>运维</span> <span>/</span> <span>测试</span> <span>/</span> <span>数据库</span> <i> 60 c;</i> </a> </div> <div class= "menu-item" > <a href= "" > <span>UI设计</span> <span>/</span> <span> 3 D动画</span> <span>/</span> <span>游戏</span> <i> 60 c;</i> </a> </div> </div> <!--轮播图--> <div class= "slides" id= "slides" > <a href= "" > <div class= "pic-slide slide1 slide-active" ></div> </a> <a href= "" > <div class= "pic-slide slide2" ></div> </a> <a href= "" > <div class= "pic-slide slide3" ></div> </a> <a href= "" > <div class= "pic-slide slide4" ></div> </a> <a href= "" > <div class= "pic-slide slide5" ></div> </a> <a href= "" > <div class= "pic-slide slide6" ></div> </a> </div> <!--上下箭头--> <a href= "javascript:void(0)" class= "buttom prev" id= "prev" ><div> 628 ;</div></a> <a href= "javascript:void(0)" class= "buttom next" id= "next" ><div> 628 ;</div></a> <!--小圆点--> <div class= "dots" id= "dots" > <span class= "active" ></span> <span></span> <span></span> <span></span> <span></span> <span></span> </div> </div> <script src= "javascript/script.js" ></script> </body> </html> css: *{ margin : 0 ; padding : 0 ; } @font-face { font-family : 'iconfont' ; src : url ( 'font/iconfont.eot' ); src : url ( 'font/iconfont.eot?#iefix' ) format ( 'embedded-opentype' ), url ( 'font/iconfont.woff' ) format ( 'woff' ), url ( 'font/iconfont.ttf' ) format ( 'truetype' ), url ( 'font/iconfont.svg#iconfont' ) format ( 'svg' ); } @font-face { font-family : 'iconfont2' ; src : url ( 'JT/iconfont.eot' ); src : url ( 'JT/iconfont.eot?#iefix' ) format ( 'embedded-opentype' ), url ( 'JT/iconfont.woff' ) format ( 'woff' ), url ( 'JT/iconfont.ttf' ) format ( 'truetype' ), url ( 'JT/iconfont.svg#iconfont' ) format ( 'svg' ); } .main{ width : 1151px ; height : 420px ; margin : 20px auto ; /* padding:15px 0 15px 15px;*/ position : relative ; } .menu{ width : 200px ; height : 100% ; padding : 15px 0 15px 15px ; background-color :rgba( 0 , 0 , 0 , 0.8 ); border-radius: 8px 0 0 8px ; } .menu-item{ width : 100% ; height : 60px ; font-size : 14px ; line-height : 60px ; position : relative ; } .menu-item a{ color : #ccc ; text-decoration : none ; margin-left : 10px ; } .menu-item a i{ position : absolute ; font-family : "iconfont" ; font-size : 12px ; right : 10px ; font-style : normal ; } .slides{ width : 936px ; height : 316px ; position : absolute ; top : 0 ; left : 215px ; overflow : hidden ; border-radius: 0 8px 0 0 ; } .pic-slide{ width : 936px ; height : 316px ; background : no-repeat ; display : none ; } .slide 1 { background-image : url ( "../imgs/slide1.png" ); } .slide 2 { background-image : url ( "../imgs/slide2.jpg" ); } .slide 3 { background-image : url ( "../imgs/slide3.jpg" ); } .slide 4 { background-image : url ( "../imgs/slide4.jpg" ); } .slide 5 { background-image : url ( "../imgs/slide5.jpg" ); } .slide 6 { background-image : url ( "../imgs/slide6.jpg" ); } .slide-active{ display : block ; } .buttom{ position : absolute ; width : 35px ; height : 55px ; line-height : 55px ; text-align : center ; left : 215px ; top : 158px ; /*background:lightpink;*/ margin-top : -25px ; font-family : "iconfont2" ; font-size : 26px ; text-decoration : none ; color : #fff ; } .buttom:hover{ background :rgba( 1 , 17 , 27 , 0.5 ); } .prev{ border-radius: 0 5px 5px 0 ; } .prev div{ transform:rotate( 180 deg); } .next{ left : auto ; right : 0 ; border-radius: 5px 0 0 5px ; } .dots{ position : absolute ; right : 20px ; bottom : 124px ; } .dots span{ display :inline- block ; width : 10px ; height : 10px ; border-radius: 50% ; margin-right : 5px ; background :rgba( 1 , 17 , 17 , 0.3 ); box-shadow: 0 0 0 1px rgba( 255 , 255 , 255 , 0.5 ) inset ; cursor : pointer ; } .dots span.active{ background : #ffffff ; box-shadow: 0 0 0 1px rgba( 1 , 17 , 27 , 0.5 ) inset ; } .sub-menu{ position : absolute ; top : -15px ; left : 215px ; width : 740px ; height : 420px ; z-index : 1 ; } .sub-menu .sub- top { width : 100% ; height : 210px ; background : #fff ; } .sub-menu .sub- top .items 1 { height : 30px ; margin : 15px 25px ; /*overflow:hidden;*/ /*zoom:1;*/ } .sub-menu .sub- top .items 1 .title{ float : left ; font-size : 14px ; font-weight : bold ; color : #FF0000 ; height : 30px ; line-height : 30px ; } .sub-menu .sub- top .items 1 .line{ float : right ; width : 622px ; height : 15px ; /*line-height:14px;*/ border-bottom : 1px solid rgba( 1 , 17 , 27 , 0.1 ); } |
0
收起
正在回答
2回答
同学你好,我试了一下,发现同学是整个sub-menu都比导航项向上一点。建议同学调整一下sub-menu的定位。
关于子菜单,建议同学再去学习一下轮播图。
如果我的回答解决了你的疑惑,请采纳。祝:学习愉快!
从网页搭建入门Java Web2018版
- 参与学习 人
- 提交作业 1088 份
- 解答问题 10204 个
如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧