Correction status:qualified
Teacher's comments:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>homework</title> <style type="text/css"> /*1.父元素是块元素,子元素是行内元素*/ .top { width: 500px; height: 50px; background-color: #ffff0a; /*水平居中*/ text-align: center; } .top p { /*垂直居中*/ line-height: 50px; } .middle { width: 500px; height: 200px; } /*2.父元素是块元素,子元素是多行的内联/行内文本*/ .left { width: 200px; height: 200px; /*水平居中*/ text-align: center; /*垂直居中*/ display: table-cell; vertical-align: middle; } /*3.父元素是块元素,子元素是块元素*/ .right { width: 300px; height: 200px; background-color: skyblue; /*垂直居中*/ display: table-cell; vertical-align: middle; } .color { width: 150px; height: 100px; background-color: green; /*水平居中*/ margin: auto; } /*4.父元素是块元素,子元素是不定宽的块元素*/ .bottom { width: 500px; height: 50px; background-color: #ffff0a; /*水平居中*/ text-align: center; /*底边居中*/ display: table-cell; vertical-align: bottom; } .bottom ul { padding: 0; } .bottom ul li { list-style: none; display: inline; } </style> </head> <body> <div class="top"> <p>实时热点</p> </div> <div class="middle"> <div class="left"> <a href="">特朗普开打贸易战</a><br> <a href="">欧文接受左膝手术</a><br> <a href="">日核电站机组重启</a><br> <a href="">法国2-3哥伦比亚</a><br> <a href="">美对伊朗实施制裁</a> </div> <div class="right"> <div class="color"></div> </div> </div> <div class="bottom"> <ul> <li><a href="">1</a></li> <li><a href="">2</a></li> <li><a href="">3</a></li> <li><a href="">4</a></li> <li><a href="">5</a></li> </ul> </div> </body> </html>
点击 "运行实例" 按钮查看在线实例
手抄代码: