(编辑:jimmy 日期: 2024/11/2 浏览:2)
水平居中布局
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>水平居中布局</title> <style> *{ margin: 0; padding: 0; } .parent { width: 100%; background: green; text-align: center; } .child { display: inline-block; width: 800px; height: 100px; background: blue; } </style> </head> <body> <div class="parent"> <div class="child">1</div> <div class="child">2</div> <div class="child">3</div> <div class="child">4</div> <div class="child">5</div> <div class="child">6</div> </div> </body> </html>
总结
以上所述是小编给大家介绍的HTML+CSS实现单列布局水平居中布局,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!