<HTML> <body> <header>...</header> <article>...</article> <asIDe>...</asIDe> <footer>...</footer> </body></HTML>
这里有一些复制粘贴HTML.如何修改CSS以使其正常工作?
<!DOCTYPE HTML><HTML> <head> <style type="text/CSS"> * { margin: 0; padding: 0; } ul { List-style: none; } p { margin-bottom: 10px; } article { display: inline-block; height: auto; wIDth: 69%; } asIDe { display: inline-block; height: auto; wIDth: 30%; } footer { height: 30px; } </style> </head> <body> <header> <h1>Lorem Ipsum</h1> </header> <article> <p>Lorem ipsum dolor sit amet,consectetur adipiscing elit. Nullam eu viverra mauris. Fusce at erat risus. Class aptent taciti sociosqu ad litora torquent per conubia nostra,per inceptos himenaeos. Sed tincIDunt orci eget justo ornare vel iaculis mauris commodo. Ut ID leo ipsum. Donec nunc est,convallis sit amet vehicula eget,laoreet ID odio. Proin vitae purus magna. Maecenas lorem lacus,convallis ac imperdIEt in,ullamcorper sed leo. Maecenas suscipit justo at arcu placerat eu ultricIEs orci placerat. Etiam vel erat in metus porttitor tristique vel ultricIEs ante. Aliquam sed porttitor nunc. Sed venenatis,sAPIen lacinia laoreet facilisis,lectus turpis iaculis leo,nec rhoncus tellus erat bibendum felis. Integer cursus malesuada sem ID vehicula. Duis venenatis pellentesque nisi ut vulputate. Nunc elit sAPIen,pulvinar blandit suscipit ut,imperdIEt ut neque. Cras odio dolor,commodo vitae malesuada sed,tempus sed neque.</p> <p>Sed nec ornare libero. Vivamus ut risus at ligula dignissim lobortis. Pellentesque dignissim iaculis fringilla. Quisque porta sagittis massa eu euismod. Vivamus nunc lectus,iaculis vitae tincIDunt et,placerat at risus. Nunc elementum massa at ligula blandit quis volutpat nulla malesuada. Nunc felis massa,placerat at vehicula non,gravida a nibh. Fusce adipiscing magna et nisl aliquet vehicula posuere tortor tempor. Aliquam erat volutpat. Duis eu enim sit amet lacus hendrerit elementum vitae a purus.</p> <p>Phasellus porttitor congue tellus,eget rhoncus eros consequat a. Donec faucibus lorem at sAPIen aliquam tempus. Sed sed vulputate magna. Proin eros felis,eleifend vitae posuere vel,dictum ut purus. Pellentesque ID felis sit amet neque consectetur porta. Donec non tellus augue,a sollicitudin libero. Nullam blandit hendrerit lacus. Quisque ac libero sAPIen. Etiam luctus tellus non sAPIen fringilla ultrices. Aliquam ut erat ut sAPIen mattis rhoncus nec eu enim. Aenean elementum dui in ligula fermentum nec egestas dui luctus. Praesent sed purus ID tellus lacinia aliquam. Donec luctus,metus ut pulvinar bibendum,sAPIen dui aliquet est,volutpat cursus enim massa non sAPIen. Quisque mollis nisl a arcu ullamcorper porta. Nunc dAPIbus pellentesque dui in varius. Donec et eros ut lacus commodo vehicula.</p> </article> <asIDe> <ul> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul> </asIDe> <footer> <span>Made by me.</span> </footer> </body> </HTML>解决方法 鉴于没有额外的标记的要求,不关心IE(在ie8中工作),我提出了这个解决方案(这需要使用固定的高度标题).我确实不得不使用浮动而不是显示:inline-block,因为我的Safari 4.0没有显示这个解决方案的最小高度:
<style type="text/CSS"> * { margin: 0; padding: 0; } HTML { height: 100%; } body { height: 100%; /*below for illustration only*/ background: yellow; } #header { position: relative; z-index: 1; height: 60px; margin-bottom: -60px; /*below for illustration only*/ background: red; opacity: .8; } #Article { float: left; min-height: 100%; wIDth: 69.9%; vertical-align: top; margin-bottom: -30px; /*below for illustration only*/ background: blue; } #AsIDe { float: left; min-height: 100%; wIDth: 30%; vertical-align: top; margin-bottom: -30px; /*below for illustration only*/ background: green; } #Article:before,#AsIDe:before { content: ' '; display: block; height: 60px; wIDth: 100%; } #Article:after,#AsIDe:after { content: ' '; display: block; height: 30px; wIDth: 100%; } #Footer { position: relative; z-index: 1; height: 30px; margin-top: -30px; clear: left; /*below for illustration only*/ background: pink; opacity: .8; } </style>
HTML只是:
<body> <div ID="header">header</div> <div ID="Article">Article</div> <div ID="AsIDe">AsIDe</div> <div ID="Footer">Footer</div></body>总结
以上是内存溢出为你收集整理的html – 使页脚不会上升到屏幕的底部,无需额外的标记全部内容,希望文章能够帮你解决html – 使页脚不会上升到屏幕的底部,无需额外的标记所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)