网页制作 > CSS > Div+CSS教程 > 5个DIV并排在一行的一种方法 2010-03-17 00:00:52 脚本之家 <html> <head> <title>一种5个DIV并排在一行的方法</title> <style type="text/css"> #bottom { margin:0 auto;/*下边居是0 */ width:300px; } #bottom div { width:60px; } #d1 { float:left; background:#f00; } #d2 { float:right; background:#0f0; } #d3 { float:right; background:#00f; } #d4 { float:right; background:#00f; } #d5 { float:right; background:#00f; } </style> </head> <body> <div id="bottom"> <div id="d3">d3</div> <div id="d1">d1</div> <div id="d2">d2</div> <div id="d4">d4</div> <div id="d5">d5</div> </div> </body> </html> 提示:您可以先修改部分代码再运行