怎样设置才能放大和缩小都不影响布局?
在放大情况下,header和banner最左边会留白的原因是什么?怎么解决?
例如像慕课网首页这里
0
收起
正在回答
3回答
测试了同学的代码,并没有复现同学描述的情况。或者同学再具体、详细的描述一下。
Elvis_T
2019-02-17 14:56:54
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 | <!DOCTYPE html> < html > < head > < meta charset = "UTF-8" > < title >imooc</ title > < link rel = "stylesheet" type = "text/css" href = "css/style.css" > </ head > < body > < header > < div class = "container" > < a href = "index.html" >< img src = "images/logo.png" ></ a > < nav > < a class = "Home" href = "index.html" >Home</ a > < a class = "Course" href = "#" >Course</ a > < a class = "Actual" href = "#" >Actual</ a > < a class = "Plan" href = "#" >Plan</ a > < a class = "FAQ" href = "#" >FAQ</ a > < a class = "Notes" href = "#" >Notes</ a > </ nav > </ div > </ header > < section class = "banner" > < ul > < li class = "active" >< img src = "images/banner/banner1.jpg" ></ li > < li class = "left" >< img src = "images/banner/banner3.jpg" ></ li > < li class = "right" >< img src = "images/banner/banner2.jpg" ></ li > </ ul > </ section > < section class = "main" > < aside > < h1 >Recent< samp >Course</ samp ></ h1 > < dl > < dt >Hyper Text Markup Language</ dt > < dd >< img src = "images/Course/05_05.png" ></ dd > < dd >HTML is the standard markup language used to create web pages and its elements form the building blocks of all websites. Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents. JavaScript is a high-level, dynamic, untyped, and interpreted programming language. AngularJS is an open-source web application framework mainly maintained by Google and by a community of individuals and...</ dd > </ dl > < dl > < dt >Cascading Style Sheets</ dt > < dd >< img src = "images/Course/06_04.png" ></ dd > < dd >HTML is the standard markup language used to create web pages and its elements form the building blocks of all websites. Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents. JavaScript is a high-level, dynamic, untyped, and interpreted programming language. AngularJS is an open-source web application framework mainly maintained by Google and by a community of individuals and...</ dd > </ dl > < dl > < dt >JavaScript</ dt > < dd >< img src = "images/Course/09_07.png" ></ dd > < dd >HTML is the standard markup language used to create web pages and its elements form the building blocks of all websites. Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents. JavaScript is a high-level, dynamic, untyped, and interpreted programming language. AngularJS is an open-source web application framework mainly maintained by Google and by a community of individuals and...</ dd > </ dl > < dl > < dt >AngularJS</ dt > < dd >< img src = "images/Course/02_09.png" ></ dd > < dd >HTML is the standard markup language used to create web pages and its elements form the building blocks of all websites. Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents. JavaScript is a high-level, dynamic, untyped, and interpreted programming language. AngularJS is an open-source web application framework mainly maintained by Google and by a community of individuals and...</ dd > </ dl > </ aside > < article > < h1 >Welcome to Massive Open Online Course!</ h1 > < p >We provide the latest knowledge to help you cope with the changing world!</ p > < img src = "images/article.jpg" > < p >We hope that all the students who love the Internet can be more convenient access to learning resources, using the Internet thinking to change our learning.</ p > < p >Focus on IT skills education MOOC, consistent with the development trend of the Internet down to earth's MOOC. We are free, we only teach useful, we concentrate on education.</ p > </ article > </ section > < footer > < div class = "container" > < p class = "left" >Copyright © 2016 imooc.com All Rights Reserved.</ p > < span class = "right" > < a href = "#" >< img src = "images/icon/weichat.png" ></ a > < a href = "#" >< img src = "images/icon/sina.png" ></ a > < a href = "#" >< img src = "images/icon/qq.png" ></ a > </ span > </ div > </ footer > </ body > </ html > |
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 | *{ margin : 0 ; padding : 0 ; font-family : Arial ; font-size : 14px ; border : none ; } a{ text-decoration : none ; } ul{ list-style : none ; } header { background : #000 ; height : 80px ; min-width : 1200px ; } header > .container{ width : 1000px ; margin : 0 auto ; } header > .container >a { display : block ; float : left ; margin : 5px 25px ; } header > .container > nav{ float : right ; } header > .container >nav >a{ font-size : 24px ; line-height : 73px ; display : block ; float : left ; width : 110px ; height : 73px ; text-align : center ; color : #FFF ; } header > .container > nav > a.Home{ background : #433b90 ;} header > .container > nav > a.Course{ background : #017fcb } header > .container > nav > a.Actual{ background : #786917 ;} header > .container > nav > a.Plan{ background : #feb800 ;} header > .container > nav > a.FAQ{ background : #f27c01 ;} header > .container > nav > a.Notes{ background : #d40112 ;} header > .container > nav > a:hover, header > .container > nav > a.active{ padding-bottom : 3px ; padding-top : 4px ;} /*banner*/ .banner{ background : #eaeaea ; min-width : 1200px ; } .banner > ul{ position : relative ; width : 1000px ; height : 538px ; margin : 0 auto ; padding-top : 10px ; } .banner > ul > li{ position : absolute ; width : 510px ; height : 300px ; overflow : hidden ; } .banner > ul > li.active{ z-index : 2 ; top : 0px ; right : 0 ; bottom : 0 ; left : 0 ; width : 600px ; height : 400px ; margin : auto ; border : 1px solid #FFF ; } .banner > ul > li. left { z-index : 1 ; top : 0 ; bottom : 0 ; left : 0 ; margin : auto ; } .banner >ul > li. right { z-index : 1 ; top : 0 ; right : 0 ; bottom : 0 ; margin : auto ; } .banner > ul > li > img{ position : absolute ; height : 100% ; left : -30% ; } /*footer*/ footer{ min-width : 1000px ; background : #CCC ; } footer > .container{ width : 1000px ; margin : 0 auto ; } footer > .container > p{ display : block ; float : left ; } footer > .container > p. left { top : 0 ; bottom : 0 ; left : 0 ; margin : 0 auto ; } footer > .container > span{ float : right ; } |
目前的代码,Ctrl+滚轮后的内容,因为慕课首页的头部放大和缩小都不会影响布局,那么应该是有一种方法可以使整个body整体按比列放大或者缩小才是吧
响应式开发与常用框架 2018
- 参与学习 人
- 提交作业 2198 份
- 解答问题 5012 个
如果你有web端基础,既想进阶,又想进军移动端开发,那就来吧,我们专题为你带来的课程有HTML5、CSS3、移动基础、响应式、bootstrap、less等,让你在前端道路上畅通无阻!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧