左浮动、右浮动的CSS对齐方法,两个CSS固定浮动的方框,一个左上对齐,一个右下对齐,随浏览器的大小始终不会变化,这里面用到了两个重要的CSS属性:一个是position,另一个是Left和Right属性。 演示: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>左浮动、右浮动的CSS对齐方法</title> <style>#box1 { position: absolute; top: 10px; left: 20px; width: 100px; background-color: #B0C4DE; border: 2px solid #34537D } #box2 { position: absolute; bottom: 2em; right: 2em; width: 100px; background-color: #FFFAFA; border: 2px solid #CD5C5C; }</style> </head> <body> <div id="box1">This is box one. It is positioned 10 pixels from the top and 20 pixels from the left of the viewport</div> <div id="box2">This is box two. It is positioned 2 em from the bottom and 2 em from the right of the viewport</div> </body> </html><br /><center>如不能显示效果,请按Ctrl+F5刷新本页,更多网页代码:<a href='http://www.veryhuo.com/' target='_blank'>http://www.veryhuo.com/</a></center>提示:可修改后代码再运行! 文章导航 相比为国生娃,“为国上云”的可行性更大一些Css 结合图片修饰的圆角边框代码